An easier way to set up diff and merge tools for Git on Windows

I’ve noticed a fair number of people are looking at my older posts on setting up diff and merge tools and the update on configuring git difftool. These posts cover how to write wrapper scripts around your diff and merge tool of choice (I was using DiffMerge at the time) and get Git to use them.

I’m not doing this any more, opting for a much simpler method. I thought I’d share it in the event you just want to get something up and running as fast as possible, and that you aren’t too particular about which diff tool you use.

First step, install KDiff3. It’s not the prettiest GUI in the world, but once you get used to it it is quite usable and has the added advantage of working quite naturally with Git without having to configure much.

Second step, open your .gitconfig (in your home directory, C:\Users\(username), or down ye olde Documents and Settings path), and add the following:

[diff]
    tool = kdiff3

[merge]
    tool = kdiff3

[mergetool "kdiff3"]
    path = C:/Program Files/KDiff3/kdiff3.exe
    keepBackup = false
    trustExitCode = false

Now all calls to git difftool and git mergetool should default to KDiff3. That’s all you need to be good to go! Much simpler than bothering with all those wrappers. Hope this helps! :)

Certified as working on my machine, running Git 1.7.0.2 (msysgit).

Comments