Can't launch external merge tool (WinMerge) on Windows

Joakim Johansson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 20, 2013

I've set the external merge tool to be WinMerge, and I've also tried using the Custom option and pointing it to the exe-file, but I'm having trouble launching either, and I can't find any information on what the custom option needs to work.

When trying to launch external merge tool, a window pops up and disappears really quickly, and no application starts.

2 answers

1 accepted

4 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2013

You can only use WinMerge as an external diff tool, not as an external merge tool (that's why it's not in the list of merge tools).

Ironically despite its name, WinMerge is not a proper merge tool, it only does 2-way comparisons rather than the 3-way merge that Git uses.

Joakim Johansson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 20, 2013

Right! Ended up using Beyond Compare. I don't know how I managed to miss the "Merge tool" part and only see the "External diff tool", figures why I couldn't get any merge going. Thanks!

Jonathan Demeyer
Contributor
November 26, 2018

Since 2.16.0 (released 4 days ago), it supports 3-way merges !

Like Mariana Schiff likes this
Francois du Plessis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 26, 2018

@Jonathan Demeyerdo you have a working config example?

Like Keith Russell likes this
Jonathan Demeyer
Contributor
November 27, 2018

@Francois du Plessis I use the "custom" option, give the path to Winmerge and give those arguments :

-e -u -dl \"Mine\" -dm \"Merged\" -dr \"Theirs\" \"$LOCAL\" \"$MERGED\" \"$REMOTE\"
Like # people like this
Daniel Jonsson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 16, 2019

@Jonathan DemeyerThank you and God bless

7 votes
Shawn Murphy
Contributor
March 13, 2017

I guess I need to look into 3-way merge more that Steve Streetling mentions but I have setup WinMerge as an external tool.  Here are the settings needed.  It sets the display so your local file is on the right site.

The setting location: Tools->Options->Diff
  External Diff Tool: Custom
   Diff Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe
   Arguments: $LOCAL $REMOTE
  External Merge Tool: Custom 
   Merge Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe
   Arguments: /w1 $LOCAL $REMOTE $MERGED

Shawn Murphy
Contributor
May 16, 2019

Update:  WinMerge can now do 3 files.  So now you can include the base file.

External Diff Tool: WinMerge
   Diff Command: C:\Program Files\WinMerge\WinMergeU.exe
   Arguments:

-wl -dl Remote -dr Local \"$REMOTE\" \"$LOCAL\"


  External Merge Tool: WinMerge
   Merge Command: C:\Program Files\WinMerge\WinMergeU.exe
   Arguments: 

-wl -wr -dl Remote -dm Base -dr Local \"$REMOTE\" \"$BASE\" \"$LOCAL\" -o \"$MERGED\"

To explain the arguments:

"-wl" makes left file ($Remote) read only so you don't accidentally start editing the wrong file.

"-wr" read only for the right ($Local) file

"-dl Remote" Naming the $Remote file "Remote"

"-dm Base" Naming the $Base file "Base"

"-dr Local" Naming the $Local file "Local"

"-o" sets up $Merged as the output file as your result of the merge.

source: http://manual.winmerge.org/Command_line.html

EDIT:20211028 Fix arguments to maintain conventional naming and make the middle file the merge file for a 3 way merge.

Like # people like this
Guillaume Tong
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2020

@Shawn Murphy Thank you very much for sharing these settings, but I found that there were some parts of your merge arguments that could be improved upon:

  1. "-wm" makes the middle file read only, but the middle file is the one we actually want to edit, and this flag therefore disables the very useful auto-merge feature from WinMerge. I replace that with "-wr" to make the right ($Local) file protected instead
  2. $LOCAL $BASE $REMOTE $MERGED : These all lack surrounding quotes which are there in other versions of the arguments posed here. I assume these serve to ensure the file names can still work even if they contain spaces and special characters, so I am putting them in.
  3. This one is just down to personal preference, but you are naming the Base file as "Base", and the Local file as "Local"... but the Remote file as "PreviousVersion". I personally prefer to follow the simplest convention and name the Remote file as "Remote". (This one does NOT affect functionality, feel free not to include this one)

Please correct me if I am wrong.

This results in the following arguments for merge:

-wl -wr -dl Remote -dm Base -dr Local \"$LOCAL\" \"$BASE\" \"$REMOTE\" -o \"$MERGED\"
Like # people like this
Shawn Murphy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 14, 2020

Thanks @Guillaume Tong .  I missed the quotes.  Good catch.  I'll have to look more into the auto-merge function of WinMerge.  I did not know about it.

s_kniebuehler January 8, 2021

Hi,

I think the Remote and the Local must be switch otherwise it will be show not correct in the header names as the opened file.

I think it must be change to this:

-wl -wr -dl Remote -dm Base -dr Local \"$REMOTE\" \"$BASE\" \"$LOCAL\" -o \"$MERGED\"
Couru D_avance
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2021

@s_kniebuehler  No i don't think so. For me the right anwser is the one  @Guillaume Tong 

Even though that should be the right behavior, it isn't. It appears that winmerge reverses the order of the files in the application panels. Below my command line 

-e -u -x -wr -wl -dl \"Local - \"$MERGED\"\" -dm Base -dr \"Remote - \"$LOCAL\"\" \"$REMOTE\" \"$BASE\" \"$LOCAL\" -o \"$MERGED\"
s_kniebuehler April 19, 2021

@Couru D_avance I have done a test with winmerge 2.16.6.0 where I have written three files: remote.txt, base.txt and local.txt. I have written in the files the name of the file.
Then you can easy see what is happen.

Question to your command line:
Why do you add $MERGED to the title of the left side? This side is read only.

Like Shawn Murphy likes this
Shawn Murphy
Contributor
October 28, 2021

Thanks @s_kniebuehler .  Just did your test with the command line arguments and merging 3 files with their name in each file.  The arguments in the Suggestion above were right on.

-wl -wr -dl Remote -dm Base -dr Local \"$REMOTE\" \"$BASE\" \"$LOCAL\" -o \"$MERGED\"

As for the $Merged on the left, that is requesting WinMerge to pass this file (the final result in the middle pane) back to SourceTree as the result of the merge process.  SourceTree then stages that file for commit. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events