1

When I use git blame, a very time-spending situation is that the file has been renamed for many times, the blame will point me to the SHA of the recent rename commit. I then need to blame on the rename version, if the file has been renamed multiple times, I need to blame multiple times.

What I need to find with blame is the real author of a line of code when it is first written. Commit of git mv is not what I am looking for

Is there a way to let blame go beyond the renaming commits?

Or at least, is there a git command that can directly list how many times a file has been renamed? With this history I can manually bisect to find the appropriate version to blame, instead of go all the way from end to beginning.

Eric Sun
  • 777
  • 6
  • 20
  • This is no guaranteed way to do this, because sometimes Git cannot track files across renames (but, sometimes it _can_). Best practice is to avoid renaming and moving files. Or at least, you should aim to do it very sparingly. – Tim Biegeleisen Mar 29 '21 at 09:49
  • For a large cooperating project, the rename history cannot be controlled by me – Eric Sun Mar 30 '21 at 15:42

0 Answers0