Amending a git mergetool job

42 views Asked by At

I just did a round of git mergetool but realized I mismerged one of the files. I tried to do git mergetool hoping to see the left (mine), right (theirs) and middle (merged) again but it told me there are no merges needed. How do I amend the merge seeing all the divergences involved just like the first time?

1

There are 1 answers

0
VonC On BEST ANSWER

If you just committed that merge (without any other modification), you can nuke that last commit (again, make sure you don't have any other work in progress):

git reset --merge ORIG_HEAD

See more at "Undoing a merge".


If you didn't commit yet (just merge), you can do a:

git checkout -m -- .

Make sure you don't have other works in progress (not yet added to the index), as they might be replaced by their version from the index.

You don't have to apply it to the all repo: You can limit that operation to a sub-folder where you need to redo the merge:

git checkout -m -- /path/to/folder

From git checkout:

With -m, changes made to the working tree file can be discarded to re-create the original conflicted merge result.