Search code examples
gitvisual-studiovisual-studio-2017araxis-merge

How do I configure Araxis Merge for use with Visual Studio Git?


I have to use Git with Visual Studio 2017 now, and there doesn't seem to be a way to link Araxis Merge with Visual Studio / Git.

This explains how to link Visual Studio TFS with Araxis.

This explains how to link Git with Araxis.

But how to link Visual Studio 2017 Plug-in Selection (with Git) to Araxis?

enter image description here


Solution

  • If you're running Visual Studio 2019 Enterprise (as I am--this might work for other versions of Visual Studio that use built-in Git for source control):

    1. Navigate to the folder that contains the global .gitconfig file, which is at: %HOMEDRIVE%%HOMEPATH% (your user folder).
    2. Find .gitconfig there and edit it with Notepad.exe, or some other text editor.

    You're going to be looking for four key sections: [diff], [difftool], [merge], and [mergetool].

    • [diff]: Tells Visual Studio Git which diff tool to launch when you compare one version of a file with another.
    • [difftool]: Specifies the name of the diff tool as well as the commandline to execute to launch that tool.
    • [merge]: Tells Visual Studio Git which merge tool to launch when you merge one file with another.
    • [mergetool]: Specifies the name of the merge tool as well as the commandline to execute to launch that tool.

    I suggest removing your existing [diff], [difftool], [merge], and [mergetool] sections and replacing them so that your gitconfig file looks something like this:

    [user]
        name = <your name>
        email = <your email address>
    [diff]
        tool = araxisdiff
    [difftool "araxisdiff"]
        cmd = \"C:\\Program Files\\Araxis\\Araxis Merge\\Merge.exe\" \"$LOCAL\" \"$REMOTE\"
    [merge]
        tool = araxismerge
    [mergetool "araxismerge"]
        cmd = \"C:\\Program Files\\Araxis\\Araxis Merge\\Merge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"
    [difftool "vsdiffmerge"]
        cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
        keepBackup = false
    

    What's going on is rather straightforward: The [diff] section specifies which of the [difftool] entries will be used for file compares; the [merge] section specifies which of the [mergetool] entries will be used for file merges. In the above case, I specified araxisdiff as my diff tool and araxismerge as my merge tool. If I wanted to use the built-in Visual Studio diff/merge tool, I could change the tool = statement for each so that it specifies vsdiffmerge instead.