8

So I have a thing happen to me that happened once before: I’d done git log --follow «file» and the newest commit I saw was the deletion of «file». However, the file was still in my repo.

Later I figured out that I’d re-added the file in a merge commit (probably one line of development had removed the file while the other one had changed it).

However, git log «file» (or git log --follow «file») seems to ignore merge commits when looking for changes to «file». Is there any way to force it to not do that?

I’m using git 2.4.0.

1 Answer 1

7

Try adding the --simplify-merges flag. Despite sounding like an option that would remove merges from the log, it actually adds them in many cases.

Taken from this answer.

4
  • 1
    Unfortunately, --simplify-merges does not help in this case. git log --follow --simplify-merges -- «file» still does not show the merge in the log. Commented Nov 18, 2015 at 10:43
  • 2
    You need "-c" additionally, see stackoverflow.com/questions/43138569/…
    – Étienne
    Commented Mar 7, 2019 at 16:55
  • Thanks, @Étienne, I can confirm that -c will include the merge commit in the list of commits output by git diff --follow, even without --simplify-merges. Commented Oct 14, 2020 at 11:30
  • Today I had such a case again and while -c made merge commits show up, they had no relation to the changed file so I’m back to square 1 now… Commented Jan 15, 2021 at 12:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .