0

When git encounters conflicts upon merging, a list is displayed, where every entry begins with CONFLICT and contains information about the reason of the conflict, like (renamed/deleted).

I am looking for a way to retrieve this exact list after rebooting the machine or merely closing the CLI.

There is of course:

git diff --name-only --diff-filter=U

However this does not contain information about the reason for the conflict, so finding this out for 50+ files is more effort than resetting git and redoing the merge.

Can this be achieved, e.g. using reflog?

EDIT: Please note, this question refers specifically to the list described, I am not asking for other solutions to resolve merge conflicts.

Koenigsberg
  • 1,726
  • 1
  • 10
  • 22
  • 1
    Unfortunately, Git drops some of the important information after detecting a rename/rename conflict. If there is *only one* such conflict, it's recoverable, otherwise it's tricky. (I think this applies to rename/delete conflicts as well—renames in general aren't quite recorded correctly.) – torek Apr 11 '19 at 08:31
  • I try to reproduce a similar conflict to analyse the situation better. @Mär, Could you indicate me the version of Git you are using please? – padawin Apr 11 '19 at 09:03
  • @padawin Version: `2.21.0.windows.1`, however before you decide to dive in - I suspect that @torek is likely to be correct about this information not being stored/retrievable once the CLI output is no longer available. – Koenigsberg Apr 11 '19 at 09:06
  • Fair enough, sorry for that. – padawin Apr 11 '19 at 09:09
  • Don't worry about it. Besides, your response may yet help someone else. – Koenigsberg Apr 11 '19 at 09:20

1 Answers1

1

while still in merge state, if you run git status, you will find files under the section Unmerged paths, these are your conflicting files (Depending on the type of the conflict, the files will be marked as "both modified", "both added", "both deleted"...).

And to solve a conflict in general, if you use git mergetool it will go through the conflicting files automatically.

padawin
  • 4,230
  • 15
  • 19
  • `git status` does not retrieve the exact list, it is a subset of the CLI message one gets initially upon merge conflict. – Koenigsberg Apr 11 '19 at 07:50
  • my apologies, I reworded to be more accurate (after having actually made a conflict and not answered by memory...), the whole list is under the "Unmerged paths" section. – padawin Apr 11 '19 at 08:07
  • As described, it is not the same list I am asking for. I am aware of `git status`, but it does not include reasons for the conflict and I am specifically asking for the list including entries such as: `CONFLICT (rename/rename): Rename -> in `. With `git status` I do not get that information. I will upvote your response for the effort and because it may solve someone's trouble with `git merge`, but it does not answer my question. – Koenigsberg Apr 11 '19 at 08:14