0

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 = turek1992@o2.pl
    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.

Michał Turczyn
  • 32,028
  • 14
  • 47
  • 69
  • fwiw: kdiff3 has a standard config included with git, you shouldn't need to specify the `mergetool.kdiff3.*` and `difftool.kdiff3.*` options – LeGEC Feb 01 '23 at 10:19
  • not clear from your question : does kdiff3 open at all ? with a 3-way merge view ? – LeGEC Feb 01 '23 at 10:20
  • @LeGEC Nothing happens. Of course, i can go to installation directory and open it, but I expected it to open by default after typing in console `git mergetool` – Michał Turczyn Feb 01 '23 at 10:51
  • does it work if you remove your two `[mergetool "kdiff3"]` and `[difftool "kdiff3"]` sections ? – LeGEC Feb 01 '23 at 12:41
  • also: please update your question to make it clear that calling `git mergetool` doesn't open the editor (the terminal part that you show would be the same if kdiff3 had started) – LeGEC Feb 01 '23 at 12:46
  • @LeGEC it does not work – Michał Turczyn Feb 01 '23 at 13:08

1 Answers1

0

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
Michał Turczyn
  • 32,028
  • 14
  • 47
  • 69