@matheusbsbs / matheus-bagliano / commits / 30c7bb249e
Fork 0

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 <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Nov 23, 2005 at 09:57 UTC 30c7bb249e9b2038dd05271e055d347f84336576
1 file changed +5 -1
git-revert.sh
+5 -1
@@ -25,7 +25,7 @@ usage () {
25 esac
26 }
27
28 -no_commit= replay=
28 +no_commit= replay= edit=
29 while case "$#" in 0) break ;; esac
30 do
31 case "$1" in
@@ -36,6 +36,9 @@ do
36 -r|--r|--re|--rep|--repl|--repla|--replay)
37 replay=t
38 ;;
39 + -e|--edit)
40 + edit=t
41 + ;;
42 -*)
43 usage
44 ;;
@@ -161,6 +164,7 @@ echo >&2 "Finished one $me."
164 # If we are revert, or if our cherry-pick results in a hand merge,
165 # we had better say that the current user is responsible for that.
166
167 +[ "$edit" ] && ${EDITOR:-${VISUAL:-vi}} .msg
168 case "$no_commit" in
169 '')
170 git-commit -n -F .msg