Redo merge of just a single file
GitMergeGit Problem Overview
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?
Git Solutions
Solution 1 - Git
It seems I was just looking in the wrong place. The solution turned out to be quite simple.
git checkout -m <file>
This returns the file to its conflicted state. I can then run git mergetool
to redo the merge.
Solution 2 - Git
You can always edit the files manually.
If you are using the git merge --no-commit
, then you will simply have a prepared commit (after the auto and semi-auto) merge.
You can still safely edit the files and only commit when completely satisfied.