Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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.

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!

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

Like Mariana Schiff likes this

@Jonathan Demeyerdo you have a working config example?

Like Keith Russell likes this

@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

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

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

@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

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.

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\"

@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\"

@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

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
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,105 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you