Last Updated: February 01, 2017
· henriqueso
10153005 828673153814135 1516739759 n

WinMerge as git difftool on Windows

In case you're looking for a way to use WinMerge as your git difftool on Windows, this tip may be helpful.

In fact, it's simple to resolve and is also a silly problem but it took me a good amount of time just because of the path where WinMerge was installed at C:\Program Files (x86)\winmerge\winmergeu.exe

Not surprisingly, I faced problems with characters like the parenthesis(. And that's ok. We know we can put it between double quotes " ". But it took me a while to get it right as I wanted.

Browsing over the web you will find many ways of doing this. The way that worked pretty well for me is this one:

1) Open .gitconfig file. It's located at your home directory: c:\users\username\.gitconfig

2) Add the lines below. Pay attention to the single quotes wrapping the path to winmerge:

    tool = winmerge
[difftool "winmerge"]
    cmd = "'C:/Program Files (x86)/WinMerge/WinMergeU.exe'" -e "$LOCAL" "$REMOTE"

You can pass other parameters to WinMerge if you want. Follow the whole discussion here:

[Edited] For those wondering how to use the command, here is an example:<br />
git difftool HEAD HEAD~1

Say Thanks

3 Responses
Add your response

0 hqaxn0cr83n4ajpacvgcngt cll91y2agnlunylcgh5f24rlu 3hvpluuwahkudj3c1vur7b uzu

Hello, what do you have in $LOCAL and $REMOTE ?

over 1 year ago ·
10153005 828673153814135 1516739759 n

That is exactly the line I have in my .gitconfig. They are placeholders for WinMerge parameters. Then you may call like that:

git difftool README.md

It'll open README.md on WinMerge comparing your local version with the baseline.

over 1 year ago ·
Summer in japan 2014 12 960x960

Thanks for sharing!

4 months ago ·
Filed Under