eftshift0
eftshift0

Reputation: 30156

How can I get a list of conflicted files on merge commits (after the fact)

I'm trying to find merge revisions on projects that had conflicts in the past. Is there an easier way to do it than to replicate the merge by hand? Because I haven't been able to find a way to make git show list only the files where there were conflicts (if any).

Upvotes: 3

Views: 254

Answers (1)

torek
torek

Reputation: 487725

It's not possible in general.

The only reliable method is to repeat the merge, and even then, you must know several things that are not knowable from the repository itself. In particular, you must know:

  • the argument to -X find-renames, if there was any such argument
  • whether -X ours or -X theirs was supplied
  • the argument to -s, if there was any such argument

Since most merges don't use these arguments, you can get pretty close by repeating the merge, and that's far easier than any alternative. (If you have git worktree add or are willing to make a clone, it's easy to automate.)

(It would be nice if git merge stashed these merge arguments as a comment in a header line in the merge commit. Git would have to save them in a file for merges that stop in the middle, but that is obviously possible.)

Upvotes: 4

Related Questions