Linus Torvalds  committed 30c7bb2

Allow editing of a revert-message

I think all commit operations should allow editing of the message (ie we
should do this for merges too), but that's _particularly_ true of doing a
"git revert".

We should always explain why we needed to revert something.

This patch adds a "-e" or "--edit" flag to "git revert", although I
actually suspect it should be on by default (and we should have a
"--no-edit" flag to disable it, probably together with an automatic
disable if stdin isn't a terminal).

Signed-off-by: Linus Torvalds <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits 073dab1
  • Branches master

Comments (0)

Files changed (1)


-no_commit= replay=
+no_commit= replay= edit=
 while case "$#" in 0) break ;; esac
 	case "$1" in
+	-e|--edit)
+		edit=t
+		;;
 # If we are revert, or if our cherry-pick results in a hand merge,
 # we had better say that the current user is responsible for that.
+[ "$edit" ] && ${EDITOR:-${VISUAL:-vi}} .msg
 case "$no_commit" in
 	git-commit -n -F .msg