11

How can I find out if there were conflicts when merging a branch and what shenanigans did the person have to do to resolve those conflicts?

git log -p seems to show empty diffs for all merge commits, regardless whether they have manual changes or not.

Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378

1 Answers1

11

git show produces a combined diff for a merge commit by default, which will contain only the lines that changed as part of the conflict resolution.

git show <merge_commit_sha1>

git log takes the --cc option to produce combined diffs for merge commits. For example, to find all merge commits with manual changes you can use:

git log -p --cc --min-parents=2

and look for commits with diffs.

Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378
  • Does this show spurious differences if a different version of Git was used to create the merge commit, creating a slightly different merge if there is sufficient ambiguity? – Florian Weimer Jul 22 '17 at 12:04
  • I have 2 merges with code changes (as confirmed with TIG manual inspection). one of them "git show" has diff output, one does not. :( not a reliable solution for me. maybe one was automatic conflict resolved vs manual. not sure. – Kevin Oct 05 '22 at 00:09