git mergetool
is wonderful (in my case, I use kdiff3). However, it is not possible to use it to resolve conflicts from git am
or git apply
(or even with patch
command). Indeed, mergetool need 3 files to work (base and both modified versions) while git am
work with a modified version and a patch.
Do you know a way to use git mergetool
for conflicts produced with git am
?
I think it is necessary to guess the base file from modified version and patch. If you consider each chunk separately, it looks tricky, but not impossible.
git mergetool
should work if you've hit a three-way merge conflict.git am
runsgit apply --3way
, which uses theindex
lines ingit diff
output to locate or reconstruct (when possible) the three objects. If you're finding patches that don't apply and have missing or wrong or inadequateindex
lines, there's nothing you can do here. Well, nothing three-way-ish: you can usegit apply --reject
and then hand-massage the rejected bits in an editor, the way we used to do all of this back in the bad old days... – Nairn