Reputation: 10243
When rebasing a change I notice Git printing the following after a "git commit --amend":
11 files changed, 427 insertions(+), 2067 deletions(-)
rewrite include/File1.h (71%)
rename include/{File1.h => File2.h} (75%)
rewrite dir1/File1.cc (86%)
rename dir1/{File1.cc => File2.cc} (80%)
However, when I run git log -1 --stat afterwards it doesn't show the renames:
include/File1.h | 160 +------
include/File2.h | 166 ++++++
partition/File1.cc | 1081 ++--------------------------------------
partition/File2.cc | 1031 ++++++++++++++++++++++++++++++++++++++
Is there a way to see the renames without rebasing?
Upvotes: 2
Views: 431
Reputation: 185871
Try
git log -1 --stat -M
The -M | --find-renames
flag instructs git log
to look for renames. Similarly the -C | --find-copies
flag will also look for copies.
Long-form options:
git log -1 --stat --find-renames --find-copies
If it's not finding the renames you want, you can also adjust the threshold. For example, git log -1 --stat -M70%
will consider any new file that's at least 70% similar to a removed file to be a rename (the same applies to -C
for copies). I believe the default is 50%.
If you always want this behavior, you can set the config variable diff.renames
. If set to true
, it will always detect renames, and if set to copy
or copies
it will always detect copies as well.
Upvotes: 5