Home > Blockchain >  Cannot set KDiff3 as merge/diff tool in GIT
Cannot set KDiff3 as merge/diff tool in GIT

Time:02-05

Recently I have been trying to setup KDiff3 as mergetool. So I fetched the program, installed it and wanted to set it as GIT diff and merge tool.

In order to do that, I executed command:

git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.path "C:/Program Files/KDiff3/bin/diff3.exe"
git config --global mergetool.kdiff3.trustExitCode false

git config --global diff.guitool kdiff3
git config --global difftool.kdiff3.path "C:/Program Files/KDiff3/bin/diff3.exe"
git config --global difftool.kdiff3.trustExitCode false

Which correctly set my config file to this:

[user]
    email = [email protected]
    name = Michal Turczyn
[merge]
    tool = kdiff3
[mergetool "kdiff3"]
    path = C:/Program Files/KDiff3/bin/diff3.exe
    trustExitCode = false
[diff]
    guitool = kdiff3
[difftool "kdiff3"]
    path = C:/Program Files/KDiff3/bin/diff3.exe
    trustExitCode = false

...and now I caused conflicts in my branch, trying to open mergetool shows me only this: enter image description here

And if I press y, file stays with GIT conflict marks anyway, if I press n it simply aborts merge.

And this happens no matter whehter I use

git mergetool --tool kdiff3

or

git mergetool

Note: I always worked with VS for these purposes and it worked just fine.

The question: how to make it work, so KDiff3 correctly picks up confilted files and lets me manage it, just as it should.

CodePudding user response:

Make sure you are referring to kdiff3.exe executable. It is usually placed in main installation directory of KDiff.

In my case it was simply C:/Program Files/KDiff3/diff3.exe

So execute this instead (with corrected paths)

git config --global mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global mergetool.kdiff3.trustExitCode false

git config --global diff.guitool kdiff3
git config --global difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global difftool.kdiff3.trustExitCode false
  • Related