Setting up custom merge tool in SourceTree

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

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

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

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?

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you