Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Setting up custom merge tool in SourceTree

Andrew Eskridge April 10, 2013

I can't seem to find the correct variables needed to set up a new custom merge tool. Can anyone point me to a list of variables that SourceTree makes available to custom merge tool commands?

..\..\semanticmergetool.exe -s=src.cs -b=base.cs -d=dst.cs -r=semanticmergetoolresult.cs -emt="..\..\mergetool.exe -b=""@basefile"" -bn=""@basesymbolic"" -s=""@sourcefile"" -sn=""@sourcesymbolic"" -d=""@destinationfile"" -dn=""@destinationsymbolic"" -r=""@output"" -t=""@filetype"" -i=""@comparationmethod"" -e=""@fileencoding""" -edt="..\..\mergetool.exe  -s=""@sourcefile"" -sn=""@sourcesymbolic"" -d=""@destinationfile"" -dn=""@destinationsymbolic"" -t=""@filetype"" -i=""@comparationmethod"" -e=""@fileencoding"""

This is the command that I would execute on the commandline. The 4 variables I need from SourceTree are sourcefile, basefile, destinationfile and resultfile.

2 answers

1 accepted

1 vote
Answer accepted
KieranA
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.
April 10, 2013

Hi Andrew,

The built-in SourceTree documents provide the help. Here's an extract:

Here is where you set the external diff/merge tools. SourceTree has in-built support for FileMerge, DiffMerge, Araxis Merge, KDiff3 and more, but if you wish to use another tool you can select 'Other' and provide your own tool information.

If you do choose to use 'Other', then you should supply the full path to the tool you wish to use in the 'Command' field, and the parameters that will be needed in the 'Arguments' field, with the following placeholders being available to supply file names:

  • $LOCAL - the name of the file on your local system
  • $REMOTE - the name of the file containing the other contents you're diffing or merging against
  • $BASE - in the case of a merge, the name of a file containing the common ancestor of $LOCAL and $REMOTE
  • $MERGED - the name of the file to save merge results to

Obviously 'Diff' only needs the first two parameters. For merges, you should really pick a tool which supports 3-way merging to make your life easier (all of the tools that SourceTree supports out of the box are capable of 3-way merging).

Hope that helps

KieranA
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.
April 10, 2013

Ah, no, the Windows version is yet to have the documentation integrated :)

Andrew Eskridge April 10, 2013

Thank you very much. That's exactly what I was looking for.

On another note, I still can't seem to find the documentation anywhere. That's where I first tried to look. Maybe the windows version doesn't have built-in documentation yet?

1 vote
Danny Frencham September 3, 2013

I found this question on Google, as I was looking for the configuration for Semantic Merge Tool with SourceTree.

In case anyone else needs it, the External Diff Command arguments are: -d $LOCAL -s $REMOTE

The External Merge Command arguments are: -d $LOCAL -s $REMOTE -b $BASE -r $MERGED

Sonaten April 8, 2015

I did the same thing. It took a second or two to realize that this was what I was looking for. I'm now running Semantic Merge with Source Tree, thanks to your answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events