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?
Try
git log -1 --stat -MThe
-M | --find-renamesflag instructsgit logto look for renames. Similarly the-C | --find-copiesflag will also look for copies.Long-form options:
git log -1 --stat --find-renames --find-copiesIf 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-Cfor copies). I believe the default is 50%.If you always want this behavior, you can set the config variable
diff.renames. If set totrue, it will always detect renames, and if set tocopyorcopiesit will always detect copies as well.