Using SemanticMerge with Visual Studio tools for Git

Microsoft recently released an updated version of its Visual Studio Tools for Git. These tools allow to create, branch and merge inside Visual Studio. In this article we will see how to configure Semantic Merge Tool as custom merge tool in Visual Studio.

When we create a new project inside Visual Studio and add it to version control, a new repository is created in our local folder. Visual Studio adds its custom diff & merge tool to the repository configuration, so for using Semantic Merge, we need to modify that.

What we need to do is simply edit the file called configuration placed inside our .git folder with our favourite text editor, add the following text (replace USERNAME with your own user):

[mergetool "MergeTool"]
path = C:/Users/{USERNAME}/AppData/Local/PlasticSCM4/semanticmerge/semanticmergetool.exe
cmd = \"C:/Users/{USERNAME}/AppData/Local/PlasticSCM4/semanticmerge/semanticmergetool.exe\" -b=\"$BASE\" -bn=\"$BASE\" -s=\"$REMOTE\" -sn=\"$REMOTE\" -d=\"$LOCAL\" -a -r=\"$MERGED\" -l=csharp -emt=\"\"\"C:/Users/{USERNAME}/AppData/Local/PlasticSCM4/semanticmerge/mergetool.exe\"\" -b=\"\"@basefile\"\" -bn=\"\"@basesymbolic\"\" -s=\"\"@sourcefile\"\" -sn=\"\"@sourcesymbolic\"\" -d=\"\"@destinationfile\"\" -dn=\"\"@destinationsymbolic\"\" -r=\"\"@output\"\" -t=\"\"@filetype\"\" -i=\"\"@comparationmethod\"\" -e=\"\"@fileencoding\"\"\" -edt=\"\"\"C:/Users/{USERNAME}/AppData/Local/PlasticSCM4/semanticmerge/mergetool.exe\"\" -s=\"\"@sourcefile\"\" -sn=\"\"@sourcesymbolic\"\" -d=\"\"@destinationfile\"\" -dn=\"\"@destinationsymbolic\"\" -t=\"\"@filetype\"\" -i=\"\"@comparationmethod\"\" -e=\"\"@fileencoding\"\"\"

And finally replace the default mergetool:

[merge]
tool = vsdiffmerge (before)

[merge]
tool = MergeTool (after)

After these simple steps, when we try to merge a branch and conflicts arise, we will get this window:

Capture

If we click on “Merge” our Semantic Merge tool will launch.

Happy hacking!.

More info at SemanticMerge.com

Advertisements

2 thoughts on “Using SemanticMerge with Visual Studio tools for Git

  1. Pingback: Semantic Merge Emerges (from Beta) | rionscode

  2. Pingback: Semantic Merge Emerges (from Beta) - Rion.IO

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s