threads / patch / 37915

patchShow number of commits being rebased interactively

Subject: [PATCH] Show number of commits being rebased interactively

## tl;dr

One message between Nov 9, 2014 and Nov 9, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Onno Kortmann· Nov 9, 2014, 13:24 UTC · lore

During 'rebase -i', a wrong edit command might inadvertently drop commits. This change shows the total number of commits in the comments below the commit list. After a rebase edit, this number can be quickly compared to the line number of the last commit in the rebase TODO list.

Signed-off-by: Onno Kortmann <onno@gmx.net>
---
 git-rebase--interactive.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to git-rebase--interactive.sh +2 −0
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index b64dd28..b266dc0 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1031,9 +1031,11 @@ test -s "$todo" || echo noop >> "$todo"
 test -n "$autosquash" && rearrange_squash "$todo"
 test -n "$cmd" && add_exec_commands "$todo"
 +commitcount=$(git stripspace --strip-comments <"$todo"  | wc -l)
+
 cat >>"$todo" <<EOF
 -$comment_char Rebase $shortrevisions onto $shortonto
+$comment_char Rebase $shortrevisions onto $shortonto ($commitcount commit(s))
 EOF
 append_todo_help
 git stripspace --comment-lines >>"$todo" <<\EOF
-- 
2.2.0.rc1.1.gbab0d06

← back to recent threads