git – Redo merge of just a single file


I’m in the middle of a large merge, and I’ve used git mergetool to resolve all the conflicts, but I have not committed yet, as I wanted to make sure the merge was ok first.

It turns out that I made a mistake while resolving the conflicts in one file, and I would like to redo the conflict resolution with git mergetool on that file. As this is a large merge I would like to avoid redoing the merge on all the other files, as I understand I would have to do with git merge --abort.

I know I could just edit the file manually, but this would be quite tedious and it would be much easier to just redo the git mergetool operation. Is this possible?


It seems I was just looking in the wrong place. The solution turned out to be quite simple.

This returns the file to its conflicted state. I can then run git mergetool to redo the merge.

Leave a Reply