2

When I run the following command in Git Bash:

git difftool mybranch master

git opens up several empty instances (no files open, no diff shown) of Visual Studio, one after another.

Here's the relevant portion of my global .gitconfig, located in my home directory:

[diff]
    tool = vsdiffmerge
[difftool]
    prompt = false
[difftool "vsdiffmerge"]
    cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe"' "$LOCAL" "$REMOTE" //t
    keepbackup = false
    trustexistcode = true

I got this snippet from this link, which describes how to use the built-in Visual Studio diff tool with git.

My theory is that vsDiffMerge.exe is being called with the wrong parameters.

I've already tried creating a wrapper .sh script for vsDiffMerge.exe:

#!/bin/sh
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsDiffMerge.exe" "$2" "$5"

and setting it as an external tool in my .gitconfig, like this:

[diff]
    external = (path to my shell wrapper)

but this had a similar effect to my current efforts, except that it only opened a single instance of Visual Studio, and had to be run with git diff instead of git difftool.

Any help would be much appreciated - I haven't been able to find much relevant information on this issue.

Community
  • 1
  • 1
Nathan Friend
  • 12,155
  • 10
  • 75
  • 125

1 Answers1

2

I'm not sure the exact reason why my previous configuration wasn't working, but this is now working for me:

In my .gitconfig:

[diff]
    tool = vsDiffMerge

[difftool "vsDiffMerge"]
    cmd = "'"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsDiffMerge.exe"' $LOCAL $REMOTE"
    trustExitCode = true

I no longer need the shell wrapper script, and I can successfully view diffs like so:

git difftool mybranch master
Nathan Friend
  • 12,155
  • 10
  • 75
  • 125
  • I had the problem where running `git difftool ..` (using VS2013) would open up each file diff in a new instance of VS. lol. Removing the `//t` switch/argument and removing `prompt = [false|true]` seems to have fixed that problem. – user1021726 Dec 17 '14 at 09:19