How to configure kdiff3 instead of emerge as git mergetool?

I have Git on Mac OSX Snow Leopard, and I tried modifying my merge and diff tool to use kdiff3 instead of emerge.

But when I try to use it, it does not start kdiff GUI and does not support cmd based interface.

My setup in gitconfig:

[merge] tool = kdiff3 [mergetool "kdiff3"] cmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3 args = $base $local $other -o $output trustExitCode = false [diff] tool = kdiff3 [difftool "kdiff3"] cmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3 args = $base $local $other -o $output trustExitCode = false 

Obviously, something is missing, but what did I do wrong?

+42
git merge config kdiff3 macos
Mar 19 '12 at 19:17
source share
2 answers

The latest versions of Git have built-in support for kdiff3 , so there is no need to configure it manually using the common cmd and args settings. Instead, run:

 $ git config --global merge.tool kdiff3 

And if kdiff3 not in your PATH environment, follow these steps:

 $ git config --global mergetool.kdiff3.path /Applications/kdiff3.app/Contents/MacOS/kdiff3 

This makes git mergetool kdiff3 . Please note that there is no way to configure Git to automatically launch your merge tool after manually merging with conflicts.

If you really want to see how Git calls kdiff3 internally, check out the mergetool built-in configuration for kdiff3 .

Change For Beyond Compare 4 , which now also supports Mac OS X, just exchange kdiff3 for bc3 (yes, "3") and adjust the path in the lines above. Starting with Git 2.2.0, you can use bc as an alias for bc3 so you don't have to worry about the version number.

+111
Jan 16 '13 at 13:21
source share

Recent git versions have built-in kdiff3 support

Yes, but only Git 2.12 (Q1 2017) will allow those built-in tools to trust their exit code.

See commit 2967284 , commit 7c10605 (November 29, 2016) by David Aguilar ( davvid ) .
( gitster Junio ​​C Hamano - gitster - to commit to c4a44e2 , December 16, 2016

mergetool : honor mergetool.$tool.trustExitCode for built-in tools

Built-in merge tools contain a hard-coded assumption about whether you can trust the exit code of the tool to determine the success or failure of the merge.
Tools whose exit codes are not trusted contain calls to check_unchanged() in their merge_cmd() functions.

The problem is that the trustExitCode configuration is not performed for the built-in tools.

Learn the built-in tools honoring the trustExitCode configuration.

(see kdiff3 )

Extend run_merge_cmd() to make it responsible for calling check_unchanged() when it is not possible to return the exit code of the tool.
Remove the check_unchanged() calls from the scripts as they are no longer responsible for calling it.

0
Dec 22 '16 at
source share



All Articles