7

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.

6

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.

| improve this answer | |
  • 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. – Raphael Schweikert Nov 18 '15 at 10:43
  • 2
    You need "-c" additionally, see stackoverflow.com/questions/43138569/… – Étienne Mar 7 '19 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. – Raphael Schweikert Oct 14 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.