After installing KDiff3
for managing conflicts in git
, still the default one is opening for me:
Here is the configuration that mentioned in this answer:
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add mergetool.kdiff3.trustExitCode false
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add difftool.kdiff3.trustExitCode false
NOTE: I can be able to run KDiff3
individually with simple files, but I can't run it in my git project. Any idea?
Edit: Here is my .gitconfig :
[user]
email = vahid.vdn@gmail.com
name = vahid najafi
[diff]
tool = kdiff3
guitool = kdiff3
[merge]
tool = diffmerge
tool = kdiff3
tool = kdiff3
[mergetool "diffmerge"]
trustExitCode = true
[mergetool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
[difftool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
I do not know
kdiff3
, but you might need to add the files you want to compare to your tool call as parameters (see command line options for KDiff3 call here). In your global config (accessible viagit config --global -e
), the respective lines should look something like this:Since I did not try this with KDiff3, you might have to switch the order of
"$LOCAL" "$BASE" "$REMOTE"
and"$MERGED"
variables, but this post sould provide enough additional more information on this. Although it's about the Meld tool, I'm pretty sure the handling is analogical, and there are some pretty good and informative answers.EDIT: Assuming you use windows: You can just locate it in Windows explorer, usually in
c:\user\yourusername\.gitconfig
, and open it with any editor. In Linux, see this post. Then, replace all themerge
,mergetool
anddifftool
sections with the following:If ot does not work, it is possible that you have to change the order of
"$LOCAL" "$BASE" "$REMOTE"
and"$MERGED"
variables or remove one of them. You can find sufficient information about this in the links provided above.Finally I made another solution! I used
meld
instead ofkdiff3
. First download meld from here. Then change config formeld
in c:/Users/yourName/.gitconfig :NOTE: Try to use git
cmd
instead of windowscmd
. When you have conflict, just run :git mergetool
. For more detail and example, see here.