GIT External Diff / Merge tools

Posted by Wim on August 30, 2012

An overview of the different external git diff and merge tools, and how to configure them.

Image

Occording to the GIT book, GIT supports these external Diff / Merge tools:

GIT tool name Name (and link to website) License
[araxis] Araxis Merge Commercial
[bc3] Beyond Compare 3 Commercial
[diffuse] Diffuse Open source
[ecmerge] ECMerge Commercial
[emerge] Emerge (Emacs) Open source
[gvimdiff] gvimdiff Open source
[kdiff3] KDiff3 Open source
[meld] Meld merge Open source
[opendiff] opendiff (OS X Developer Tools)
[p4merge] P4Merge Commercial
[tkdiff] TkDiff Open source
[tortoisemerge] TortoiseMerge Open source
[vimdiff] vimdiff Open source
[xxdiff] xxdiff Open source
[kompare] Kompare Open source

Remarks:

  • TortoiseMerge: only merge tool
  • Kompare: only diff tool

You can choose your prefered diff / merge tool by executing this command (Windows or Linux), in this case for my favorite kdiff3.

git config --global diff.tool kdiff3
git config --global merge.tool kdiff3

The external diff is started using this command:

git difftool

You will probably get the error The diff tool kdiff3 is not available as 'kdiff3'. External diff died, stopping at <filename>., because GIT doesn’t find your tool. This can be resolved by adding your tool to the environment PATH variable, or by telling GIT where to find your tool(s):

git config --global difftool.kdiff3.path "C:/Program Files (x86)/KDiff3/kdiff3.exe"
git config --global mergetool.kdiff3.path "C:/Program Files (x86)/KDiff3/kdiff3.exe"

Any configuration can be undone by executing:

git config --global <config item> --unset

e.g.

git config --global mergetool.kdiff3.path --unset