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

Ability to edit message from git rebase --interactive.

From
OGOlivier Goffart <ogoffart@kde.org>
Date
Mar 17, 2009, 18:53 UTC
Message-ID
<200903171953.23650.ogoffart@kde.org>
Hello.

I use git in a workflow in wich we often need to edit the message logs of some commits. The way we do it is using git rebase -i and choose edit. But then you need to do git commit --amend and git rebase --continue, which is error prone and add more useless steps.

The attached patch add a new keyword to git rebase interactive to just edit the message log.

I was told on IRC that this has been discussed already not so long ago, and looking on the archive[1], all i seen was bikesheeding . Here is a patch :-)

Do you think it make sens to have that in git?
Please CC me replies.
-- 
Olivier


[1] http://thread.gmane.org/gmane.comp.version-control.git/105738
(my patch is different from this one as it adds a new keyword rather than 
change the behavior of one existing one)



commit 71793acdd9f926ea52d034b17ac3465e3a810799
Author: Olivier Goffart <ogoffart@kde.org>
Date:   Tue Mar 17 19:41:40 2009 +0100

    rebase interactive: add the possibility to easily edit the message log of commits

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3dc659d..6ded58e 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -406,6 +406,16 @@ do_next () {
 			die_with_patch $sha1 ""
 		fi
 		;;
+	message|m)
+		comment_for_reflog message
+
+		mark_action_done
+
+		pick_one $sha1 ||
+			die_with_patch $sha1 "Could not apply $sha1... $rest"
+
+		git commit --amend || failed=t
+		;;
 	*)
 		warn "Unknown command: $command $sha1 $rest"
 		die_with_patch $sha1 "Please fix this in the file $TODO."
@@ -730,6 +740,7 @@ first and then run 'git rebase --continue' again."
 #  p, pick = use commit
 #  e, edit = use commit, but stop for amending
 #  s, squash = use commit, but meld into previous commit
+#  m, message = use commit and promt the editor to edit the message log
 #
 # If you remove a line here THAT COMMIT WILL BE LOST.
 # However, if you remove everything, the rebase will be aborted.
Next: Johannes Schindelin
Message 1 of 16 in “Ability to edit message from git rebase --interactive.”
  1. Olivier GoffartMar 17, 2009
  2. Johannes SchindelinMar 17, 2009
  3. Jeff KingMar 18, 2009
  4. Johannes SchindelinMar 18, 2009
  5. Junio C HamanoMar 18, 2009
  6. Sverre RabbelierMar 18, 2009
  7. Michael J GruberMar 18, 2009
  8. Marcel M. CaryMar 18, 2009
  9. Marcel M. CaryMar 18, 2009
  10. Olivier GoffartApr 10, 2009
  11. Michael WittenApr 10, 2009
  12. Michael WittenApr 10, 2009
  13. Johannes SchindelinApr 10, 2009
  14. Michael WittenApr 10, 2009
  15. Sverre RabbelierApr 10, 2009
  16. Michael WittenApr 10, 2009

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.