Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDiff3 under cygwin git will not invoke

Tags:

git

cygwin

kdiff3

In keeping with a number of solutions posted on the internet I have installed KDiff3 and modified .gitconfig as below to make use of it. Nonetheless, when I run git diff HEAD^ HEAD within a repository to test it I get a diff performed by the default tool. I'm running cygwin git on Windows7-64. Can anyone explain why KDiff3 is not invoked?

[diff]
    tool = kdiff3
[merge]
    tool = kdiff3

[difftool "kdiff3"]
    path = \"D:/Program Files (x86)/KDiff3/kdiff3.exe\"
    keepBackup = false
    trustExitCode = false

[mergetool "kdiff3"]
    path = \"D:/Program Files (x86)/KDiff3/kdiff3.exe\"
    keepBackup = false
    trustExitCode = false
like image 586
lovelyzoo Avatar asked Mar 30 '26 17:03

lovelyzoo


2 Answers

Actually, the wrapper script is not needed. If kdiff3.exe is not in your path, you need to give the full path in cmd as cmd = /cygdrive/c/apps/KDiff3/kdiff3 ...

My .gitconfit

[diff]
    tool = kdiff3
[merge]
    tool = kdiff3
[difftool "kdiff3"]
    cmd = kdiff3 \"$(cygpath -wla $LOCAL)\" \"$(cygpath -wla $REMOTE)\"
    trustExitCode = false
[mergetool "kdiff3"]
    cmd = kdiff3 \"$(cygpath -wla $BASE)\" \"$(cygpath -wla $LOCAL)\" \"$(cygpath -wla $REMOTE)\" -o \"$(cygpath -wla $MERGED)\"
    keepBackup = false
    trustExitCode = false
[mergetool]
    prompt = false
[difftool]
    prompt = false
like image 199
E.L. Avatar answered Apr 02 '26 06:04

E.L.


Use git difftool to invoke the configured diff tool, not git diff.

Since you seem to be using cygwin git, but a native kdiff3, you'll probably also need to invoke a wrapper script, rather than kdiff3 directly, to use cygpath convert paths from cygwin form to native form.

like image 32
jturney Avatar answered Apr 02 '26 05:04

jturney