git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Allow editing of a revert-message

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 23, 2005, 17:57 UTC
Message-ID
<Pine.LNX.4.64.0511230954440.13959@g5.osdl.org>

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 <torvalds@osdl.org>
---
diff --git a/git-revert.sh b/git-revert.sh
index 4154fe0..05bd854 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -25,7 +25,7 @@ usage () {
 	esac
 }
 
-no_commit= replay=
+no_commit= replay= edit=
 while case "$#" in 0) break ;; esac
 do
 	case "$1" in
@@ -36,6 +36,9 @@ do
 	-r|--r|--re|--rep|--repl|--repla|--replay)
 		replay=t
 		;;
+	-e|--edit)
+		edit=t
+		;;
 	-*)
 		usage
 		;;
@@ -161,6 +164,7 @@ echo >&2 "Finished one $me."
 # 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
Next: Junio C Hamano
Message 1 of 3 in “Allow editing of a revert-message”
  1. Linus TorvaldsNov 23, 2005
  2. Junio C HamanoNov 23, 2005
  3. Linus TorvaldsNov 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.