2

Why I fail to use git apply with -3 option :

$ git apply --3way /tmp/0001-my-patch.patch
error: patch failed: a.h:9
Falling back to three-way merge...
Applied patch to 'a.h' cleanly.
error: patch failed: b.c:6
Falling back to three-way merge...
Applied patch to 'b.c' cleanly.
error: patch failed: drivers/Kconfig:1882
Falling back to three-way merge...
Applied patch to 'drivers/Kconfig' with conflicts.
U drivers/Kconfig
imz -- Ivan Zakharyaschev
  • 4,921
  • 6
  • 53
  • 104
0x90
  • 39,472
  • 36
  • 165
  • 245
  • What is the question here? It's trying the normal apply and then falls back to 3-way, as specified. – robinst Apr 18 '13 at 14:03
  • 1
    How comes the mergetool didn't open? – 0x90 Apr 18 '13 at 16:59
  • 1
    I don't remember how I solved it but, make sure the .gitconfig has the right mergetool configuration – 0x90 Jul 26 '14 at 22:44
  • Does this answer your question? [Cannot use \`git mergetool\` with \`git am\` or \`git apply\` or \`patch\`](https://stackoverflow.com/questions/52556005/cannot-use-git-mergetool-with-git-am-or-git-apply-or-patch) – imz -- Ivan Zakharyaschev Jul 27 '21 at 18:57

2 Answers2

0

From the documentation for git apply:

--3way
When the patch does not apply cleanly, fall back on 3-way merge

It looks like 3way will be ignored if the patch applies cleanly.

Guvante
  • 18,775
  • 1
  • 33
  • 64
0

Here is a way to configure diffmerge as your mergetool [taken from here]:

git config --global merge.tool diffmerge

git config --global mergetool.diffmerge.cmd "diffmerge --merge
--result=\$MERGED \$LOCAL \$BASE \$REMOTE"

git config --global mergetool.diffmerge.trustExitCode true
0x90
  • 39,472
  • 36
  • 165
  • 245