{"thread":{"id":"37915","subject":"[PATCH] Show number of commits being rebased interactively","startedAt":"2014-11-09T13:24:32Z","lastAt":"2014-11-09T13:24:32Z","messageCount":1,"participants":["Onno Kortmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"251610","messageId":"545F6B10.5010505@gmx.net","threadId":"37915","inReplyTo":null,"subject":"[PATCH] Show number of commits being rebased interactively","fromName":"Onno Kortmann","fromEmail":"onno@gmx.net","sentAt":"2014-11-09T13:24:32Z","receivedAt":"2014-11-09T13:24:32Z","isPatch":true,"sender":{"key":"onno@gmx.net","avatar":"https://avatars.githubusercontent.com/u/91150?v=4"},"body":"During 'rebase -i', a wrong edit command might inadvertently drop\ncommits. This change shows the total number of commits in the comments below\nthe commit list. After a rebase edit, this number can be quickly compared to\nthe line number of the last commit in the rebase TODO list.\n\nSigned-off-by: Onno Kortmann <onno@gmx.net>\n---\n git-rebase--interactive.sh | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex b64dd28..b266dc0 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -1031,9 +1031,11 @@ test -s \"$todo\" || echo noop >> \"$todo\"\n test -n \"$autosquash\" && rearrange_squash \"$todo\"\n test -n \"$cmd\" && add_exec_commands \"$todo\"\n +commitcount=$(git stripspace --strip-comments <\"$todo\"  | wc -l)\n+\n cat >>\"$todo\" <<EOF\n -$comment_char Rebase $shortrevisions onto $shortonto\n+$comment_char Rebase $shortrevisions onto $shortonto ($commitcount commit(s))\n EOF\n append_todo_help\n git stripspace --comment-lines >>\"$todo\" <<\\EOF\n-- \n2.2.0.rc1.1.gbab0d06\n"}]}