6

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.

imz -- Ivan Zakharyaschev
  • 4,921
  • 6
  • 53
  • 104
Jérôme Pouiller
  • 9,249
  • 5
  • 39
  • 47
  • 1
    `git mergetool` should work if you've hit a three-way merge conflict. `git am` runs `git apply --3way`, which uses the `index` lines in `git 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 inadequate `index` lines, there's nothing you can do here. Well, nothing three-way-ish: you *can* use `git 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... – torek Sep 28 '18 at 17:42

1 Answers1

3

As torek mentions, git mergetool will be involved if you are:

The issue remains for a regular patch command.

Jérôme Pouiller
  • 9,249
  • 5
  • 39
  • 47
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250