Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -dl \"Local\" -dr \"Remote\" $LOCAL $REMOTE $MERGED
[diff]
tool = winmerge
[difftool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE
@glueckandi

This comment has been minimized.

Copy link

@glueckandi glueckandi commented Oct 9, 2014

Perfect! Thanks!

@haroldGomez

This comment has been minimized.

Copy link

@haroldGomez haroldGomez commented Dec 9, 2014

Fantastic. Thanks!

@JobaDiniz

This comment has been minimized.

Copy link

@JobaDiniz JobaDiniz commented Mar 31, 2015

thanks

@jcspader

This comment has been minimized.

Copy link

@jcspader jcspader commented Jul 15, 2015

I using with Winmerge 2.14. It's working!
Tks

@bhagyesh-bhatewara

This comment has been minimized.

Copy link

@bhagyesh-bhatewara bhagyesh-bhatewara commented Oct 8, 2015

Life saver.... Works like charm. Thanks...

@martinblore

This comment has been minimized.

Copy link

@martinblore martinblore commented Mar 23, 2016

Thanks! :)

@ZenSoftware

This comment has been minimized.

Copy link

@ZenSoftware ZenSoftware commented Apr 21, 2016

Thank you very much

@DaveCsimplyhealth

This comment has been minimized.

Copy link

@DaveCsimplyhealth DaveCsimplyhealth commented Apr 22, 2016

Have edited config and am using Winmerge 2.14 but can't get it working.

@riguelbf

This comment has been minimized.

Copy link

@riguelbf riguelbf commented May 9, 2016

great! Thanks.

@FabienDehopre

This comment has been minimized.

Copy link

@FabienDehopre FabienDehopre commented Jul 6, 2016

Thanks!

@gahrae

This comment has been minimized.

Copy link

@gahrae gahrae commented Jul 12, 2016

When using Cgywin, I needed to modify the command as follows...
cmd = "/cygdrive/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e "$(cygpath -wla $LOCAL)" "$(cygpath -wla $REMOTE)"

@clezioalves

This comment has been minimized.

Copy link

@clezioalves clezioalves commented Nov 19, 2016

Perfect! Thanks.

@tssutha

This comment has been minimized.

Copy link

@tssutha tssutha commented Dec 30, 2016

Awesome 👍

@KarthikeyanMindtree

This comment has been minimized.

Copy link

@KarthikeyanMindtree KarthikeyanMindtree commented Mar 9, 2017

Worked for me. Thanks !

@zoldello

This comment has been minimized.

Copy link

@zoldello zoldello commented Mar 23, 2017

This is the result of mixing "awesome" and "sause".

@tomytree22

This comment has been minimized.

Copy link

@tomytree22 tomytree22 commented Mar 24, 2017

Thanks :) excelent solution

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Mar 31, 2017

Works for me, too. Thank you very much!

@StephenChamberlain

This comment has been minimized.

Copy link

@StephenChamberlain StephenChamberlain commented Apr 4, 2017

Great solution, thanks very much!

@MagicUnderHood

This comment has been minimized.

Copy link

@MagicUnderHood MagicUnderHood commented May 27, 2017

Thanks!

@edcolcode

This comment has been minimized.

Copy link

@edcolcode edcolcode commented Jun 3, 2017

Thanks!

@zalizko

This comment has been minimized.

Copy link

@zalizko zalizko commented Aug 3, 2017

Spasibo!

@Pagliacii

This comment has been minimized.

Copy link

@Pagliacii Pagliacii commented Aug 8, 2017

Thanks! It worked now!

@bardware

This comment has been minimized.

Copy link

@bardware bardware commented Oct 15, 2017

I see a multitude of posts on stackoverflow describing how to use WinMerge as difftool. When a file is created or deleted WinMerge tries to access \\.\nul.
Does your solution address/handle that issue?

@maiconheck

This comment has been minimized.

Copy link

@maiconheck maiconheck commented Nov 19, 2017

Works for me, too. Thank you very much!

@robertocg72

This comment has been minimized.

Copy link

@robertocg72 robertocg72 commented Dec 6, 2017

Very useful, thank you

@picasso250

This comment has been minimized.

Copy link

@picasso250 picasso250 commented Dec 12, 2017

you should use

git difftool

NOT git diff

this takes me quite a while

@hiteshkanchan

This comment has been minimized.

Copy link

@hiteshkanchan hiteshkanchan commented Feb 1, 2018

I made this change in the .gitconfig. Now how do I specify the files for comparison once in Git Bash

@nonsocode

This comment has been minimized.

Copy link

@nonsocode nonsocode commented Mar 1, 2018

Awesome

@Tbd19

This comment has been minimized.

Copy link

@Tbd19 Tbd19 commented Mar 15, 2018

Has anyone had problems with this configuration recently on Windows 10 Visual Studio 2017? I am getting this on the output; "Failed to start the configured compare tool. Using the default compare tool instead."

@angusmillar

This comment has been minimized.

Copy link

@angusmillar angusmillar commented Mar 20, 2018

Nice One!

@antru

This comment has been minimized.

Copy link

@antru antru commented May 8, 2018

Thanks

@Carcinie

This comment has been minimized.

Copy link

@Carcinie Carcinie commented May 15, 2018

i'm getting the nul path error too

@Carcinie

This comment has been minimized.

Copy link

@Carcinie Carcinie commented May 15, 2018

Tbd19 I had the same problem. This is what i did.
git difftool --tool-help

It should tell you what the available diff tools are.
I did:
git config diff.tool winmerge

@tiago-aguiar-moreira

This comment has been minimized.

Copy link

@tiago-aguiar-moreira tiago-aguiar-moreira commented Jun 29, 2018

Very helpfull. Thanks!

@cored0wn

This comment has been minimized.

Copy link

@cored0wn cored0wn commented Jul 9, 2018

Thank you man!! 👏 🎉

@aequi42

This comment has been minimized.

Copy link

@aequi42 aequi42 commented Jul 10, 2018

Thank you a lot!

@mrsaleh

This comment has been minimized.

Copy link

@mrsaleh mrsaleh commented Jul 28, 2018

Saved me a lot of time, thanks.

@RecoX

This comment has been minimized.

Copy link

@RecoX RecoX commented Feb 5, 2019

Thanks

@k9t9

This comment has been minimized.

Copy link

@k9t9 k9t9 commented Mar 25, 2019

WinMerge was supposed to be a two-way diff ( pending WinMerge3 ) and not a three-way diff as git require. is that updated to 2.16 ( 3 way ) ?

@kpuru2

This comment has been minimized.

Copy link

@kpuru2 kpuru2 commented Mar 26, 2019

Great

@jernkuan

This comment has been minimized.

Copy link

@jernkuan jernkuan commented Jun 25, 2019

This worked for me to test for empty file and fix the \nul\ problem

cmd = [[ $LOCAL != "/dev/null" ]] && "c:/Program\\ Files/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE

@mrstecklo

This comment has been minimized.

Copy link

@mrstecklo mrstecklo commented Sep 4, 2019

Thanks to the author, but I suggest this set of options for mergetool/cmd:
-u -e -fm -wl -dl "Local" -wr -dr "Remote" $LOCAL $MERGED $REMOTE
This way MERGED file is in the middle pane, so you can apply changes directly from LOCAL or REMOTE. Additionally, LOCAL and REMOTE are marked "read only"

@sugardaddy

This comment has been minimized.

Copy link

@sugardaddy sugardaddy commented Oct 9, 2019

I tried the diff settings above, but they didn't work for me. It was the path to winmerge that was not right syntactically. After trying a dozen combinations or so, I finally landed on one that worked.

I'm sure there is a version of the Windows long file name form that works, but I have stopped searching now. PROGRA~1 is the short DOS 8.3 folder name for the "Program Files (x86)" folder where my winmerge is located.

[diff]
    tool = winmerge

[difftool "winmerge"]
    name = WinMerge
    trustExitCode = true
    cmd = /c/PROGRA~2/WinMerge/WinMergeU.exe -u -e $LOCAL $REMOTE

I also tried just using tool=winmerge since that is supposed to be built-in, but it didn't work.

Tip: running this command would sometimes help me know if my path was not formatted correctly.
git difftool --tool-help

Me:

Windows 8
git version 2.21.0.windows.1

@jriley555

This comment has been minimized.

Copy link

@jriley555 jriley555 commented Dec 28, 2019

u r da man !!!! seems like i needed a diff.tool (vs difftool) entry to get this to work, though.

@christopherliu

This comment has been minimized.

Copy link

@christopherliu christopherliu commented Aug 12, 2020

Warning: This is right for diffs, but this will burn you if you use it for merges! I used this and had to redo my merge changes.

Use mrsteklo's version of the options above, or alternatively:

cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -wl -wr $LOCAL $BASE $REMOTE -o $MERGED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.