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

[PATCH] rebase: new option to post edit a squashed or fixed up commit

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Mar 9, 2014, 03:12 UTC
Message-ID
<1394334737-17406-1-git-send-email-pclouds@gmail.com>

After squashing or fixing up, you may want to have a final look at the commit, edit some more if needed or even do some testing. --postedit enables that. This is (to me) a paranoid mode so either I enable it for all squashes and fixups, or none. Hence a new option, not new todo commands that give finer selection.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-rebase.txt | 5 +++++
 git-rebase--interactive.sh   | 5 +++++
 git-rebase.sh                | 7 +++++++
 3 files changed, 17 insertions(+)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 2a93c64..dacb163 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -432,6 +432,11 @@ recreates the topic branch with fresh commits so it can be remerged
 successfully without needing to "revert the reversion" (see the
 link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
 
+--[no-]postedit::
+	With --interactive, stop after performing the command "squash"
+	or "fixup". This gives the user a chance to look at the final
+	commit and update or test it if needed.
+
 include::merge-strategies.txt[]
 
 NOTES
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a1adae8..42061fc 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -571,6 +571,11 @@ do_next () {
 			;;
 		esac
 		record_in_rewritten $sha1
+		if test -n "$postedit"
+		then
+			warn "Stopped at $sha1... $rest"
+			exit_with_patch $sha1 0
+		fi
 		;;
 	x|"exec")
 		read -r command rest < "$todo"
diff --git a/git-rebase.sh b/git-rebase.sh
index 5f6732b..2d4beb7 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -32,6 +32,7 @@ verify             allow pre-rebase hook to run
 rerere-autoupdate  allow rerere to update index with resolved conflicts
 root!              rebase all reachable commits up to the root(s)
 autosquash         move commits that begin with squash!/fixup! under -i
+postedit           stop after squash or fixup commands
 committer-date-is-author-date! passed to 'git am'
 ignore-date!       passed to 'git am'
 whitespace=!       passed to 'git apply'
@@ -264,6 +265,12 @@ do
 	--no-autosquash)
 		autosquash=
 		;;
+	--postedit)
+		postedit=t
+		;;
+	--no-postedit)
+		postedit=
+		;;
 	--fork-point)
 		fork_point=t
 		;;
-- 
1.9.0.40.gaa8c3ea
Next: Junio C Hamano
Message 1 of 3 in “rebase: new option to post edit a squashed or fixed up commit”
  1. rebase: new option to post edit a squashed or fixed up commitNguyễn Thái Ngọc Duy, Mar 9, 2014
  2. Junio C HamanoMar 10, 2014
  3. Duy NguyenMar 11, 2014

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.