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

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

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

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

3,607 views 0 11
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