3

I try to find difference of 2 commit ids. When I git diff, it prints change status of files. 'M' means 'modify'. 'D' means 'delete'. 'A' means 'add'. But what does the 'R087' stand for?

git diff  f0d1122b af122334 --name-status 

M       service/user_feature/search_user_feature_redis.h
D       service/user_feature/search_user_feature_tair.cc
A       service/user_feature/user_feature_tair.cc
R087    service/user_feature/search_user_feature_tair.h service/user_feature/user_feature_tair.h
D       thirdparty/easy/BUILD
jpbochi
  • 4,366
  • 3
  • 34
  • 43
mariolu
  • 624
  • 8
  • 17
  • Related question: https://stackoverflow.com/questions/53056942/git-diff-name-status-what-does-r100-mean – jpbochi Jan 17 '23 at 09:18

1 Answers1

5

The R stands for Rename. The 087 is a similarity score: the files before and after were 87% similar according to Git, which is enough for Git to say this was a rename operation with some changes, rather than a deletion of the "old file" and an addition of the "new file".

By default, the similarity threshold is 50%.

Reference

Wander Nauta
  • 18,832
  • 1
  • 45
  • 62
  • 1
    Note also that you can disable (`--no-renames`) or explicitly enable (`--find-renames`) rename-detection, and that whether rename detection is on by default is something you can set with your Git configuration (`git config --global diff.renames` with either `true` or `false`). The default in very old versions of Git is `false` and the default since Git 2.9 is `true`. – torek May 10 '21 at 09:02