KDiff3 is installed in C: Program Files (x86) KDiff3 kdiff3.exe I merged a feature branch in master and have a merge conflict. I rightclick on my file and select Resolve Conflicts / Launch external merge tool. KDiff3 is a diff and merge program that compares or merges two or three text input files or directories, shows the differences line by line and character by character (!), provides an automatic merge-facility.The git diff command does a great job of showing what has changed. But it shows this information on the command prompt. Some people who are addicted to nice and pretty GUI's, might get bogged down because of this.
Do not worry you people, there is a nice GUI based option. KDiff3 is the answer to this problem! This post will show how easily we can integrate the KDiff3 tool with GIT.
KDiff3 had nice and easy GUI. It does its job very well. It might not be the prettiest but its extremely simple and intuitive to use. +1 for KDiff3 from my side!
So how do we integrate KDiff3 with GIT?
How do they do it?
- Download and install KDiff3 from here.
- GIT needs to know that KDiff3 should be used as the preferred diff/merge tool. For this, we need to make a simple change in the .gitconfig file. This file can be found under your home directory.
It should look something like this
Add the following lines to the file
The path config property under the mergetool and difftool, should point to the installation path of KDiff3 tool on your machine. The updated .gitconfig file should look somewhat like this
NOTE: please use forward slash '/' as the path separator even on windows machines. Using back slash ' will not work!
The above config tells GIT to use the KDiff3 tool as the external diff/merge tool.
All set! Lights, Camera, Action!
Lets view the difftool in action.
GIT will ask your permission to launch KDiff3 for viewing the test1.txt.
Hitting enter will launch the KDiff3 again for viewing test2.txt
This command will launch the KDiff3 for each edited file, without any prompt!
Sourcetree Kdiff3 Mergetool
To use KDiff as the merge tool use the following command
Hitting enter will launch the KDiff3 as the merge tool