From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [RFC/PATCH] add diffstat information to rebase
Date: Thu, 22 Dec 2016 10:56:09 -0800 [thread overview]
Message-ID: <20161222185609.21139-1-sbeller@google.com> (raw)
Signed-off-by: Stefan Beller <sbeller@google.com>
---
When working on a large feature consisting of lots of commits,
my development workflow is to create a lot of very small commits and
then reshuffle these via interactive rebase.
Sometimes the commit message titles for these very small commits are
not as good as I thought they would, such that the interactive rebase
session needs to be accompanied by extensive use of gitk in my case.
This is a small hack that adds the diffstat to the interactive rebase
helping me a bit during the rebase, such that:
$ git rebase -i HEAD^^
pick 2eaa3f532c Third batch for 2.12
# Documentation/RelNotes/2.12.0.txt | 40 +++++++++++++++++++++++++++++++++++++++
# 1 file changed, 40 insertions(+)
pick 3170a3a57b add information to rebase
# git-rebase--interactive.sh | 2 ++
# 1 file changed, 2 insertions(+)
# Rebase 2eaa3f532c..3170a3a57b onto 2eaa3f532c (1 command)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
I am not completely satisfied with the result, as I initially wished these
information would just appear in line after the commit subject, but this
comes close. Maybe the last line also needs to be dropped.
This is not a patch meant for inclusion, as for that we'd want to hide this
feature behind an option I'd guess.
Stefan
git-rebase--interactive.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 41fd374c72..db73c69674 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1220,6 +1220,7 @@ do
if test t != "$preserve_merges"
then
printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
+ git diff --stat $sha1^..$sha1 |sed s/^/"$comment_char"/ >>"$todo"
else
if test -z "$rebase_root"
then
@@ -1238,6 +1239,7 @@ do
then
touch "$rewritten"/$sha1
printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
+ git diff --stat $sha1^..$sha1 |sed s/^/"$comment_char"/ >>"$todo"
fi
fi
done
--
2.11.0.193.g3170a3a57b
next reply other threads:[~2016-12-22 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 18:56 Stefan Beller [this message]
2016-12-22 21:41 ` [RFC/PATCH] add diffstat information to rebase Johannes Schindelin
2016-12-22 22:13 ` Stefan Beller
2016-12-22 23:05 ` Johannes Schindelin
2016-12-25 0:52 ` Duy Nguyen
2016-12-22 22:37 ` Junio C Hamano
2016-12-23 8:32 ` Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161222185609.21139-1-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).