3

Recently when I try to open git blame, but it shows the wrong data, like it shows one person and one date for the whole project.

Any idea what can cause that?

I'm using android studio but it does show the same thing in the terminal.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
max
  • 5,963
  • 12
  • 49
  • 80

1 Answers1

1

That could be the result of a massive commit involving all lines from all files, because of a code format operation.

Or because all end-of-lines have been changed from CRLF to LF (or LF to CRLF).

Check the files from the most recent commit with git show --pretty=%gd --stat: if you see all files, that would be a confirmation.


The OP max mentions in the comments:

I just clone the project again project and it's working now.

It is a very big project, so I think something during cloning something went wrong at first time.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • "That could be the result of a massive commit involving all lines from all files, because of a code format operation." not really the source code is gigantic and there is no way one person can do that also, the date that the git shows is for last year this source code has everyday contributor. – max Aug 11 '21 at 11:22
  • @max OK. What does `git show --pretty=%gd --stat` return? Just a few files? – VonC Aug 11 '21 at 11:48
  • yeah 2 files changed, 13 insertions(+), 1 deletion(-) – max Aug 11 '21 at 14:12
  • @max No `.mailmap`? (as in https://stackoverflow.com/questions/61789236/why-username-of-annotateblame-is-not-same-to-author-of-commit-in-intellij-idea#comment109293751_61789236) – VonC Aug 11 '21 at 16:06
  • @max What does a `git blame --porcelain -M -C -w -l -- aFile` returns: same user. Does this persists on branches other than main/master? Because if only one person commits pull request, then their name would be the one returned for the all file with a `git blame`. – VonC Aug 11 '21 at 16:10
  • it returns the same wrong user, and yes it's happening in different branches – max Aug 12 '21 at 01:34
  • I just clone the project again project and it's working now, it is a very big project so I think something during cloning something went wrong at first time – max Sep 30 '21 at 06:10
  • @max Thank you for this feedback. I have included your comment in the answer for more visibility. – VonC Sep 30 '21 at 06:39