2

I wanted to run a diff on a file in my project which should be a simple task, and when I select Compare with Unmodified, I get the error:

Source Control - Git
Failed to start the configured compare tool.

I've looked at the .gitconfig file that was auto-generated by VS2015 and as far as I can tell there is nothing wrong with it.

[merge]
    tool = vsdiffmerge
[diff]
    tool = vsdiffmerge
[core]
    editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor
    autocrlf = true
[credential]
[filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true
[difftool]
    prompt = false
[difftool "vsdiffmerge"]
    cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
[difftool "vsdiffmerge"]
    keepbackup = false
[mergetool]
    prompt = false
[mergetool "vsdiffmerge"]
    cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
trustexitcode = true

Any thoughts?

Hakan Fıstık
  • 11,376
  • 8
  • 74
  • 105
CodeJockey
  • 134
  • 6
  • The setup for a _visual_ diff tool, like the one with which Visual Studio ships, appears to be more complex than adding a line in `.gitconfig`. Have a look at [this SO post](http://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-a-visual-diff-program) which discusses the problem. – Tim Biegeleisen Aug 28 '15 at 05:16
  • It turns out that I had somehow installed two different versions of Git on my machine and it had a hard time deciding on which version to use. Uninstalling both and reinstalling a single version seemed to help. – CodeJockey Nov 06 '15 at 16:29
  • Please answer your own question then. – Tim Biegeleisen Nov 06 '15 at 23:19

3 Answers3

1

Uninstall all versions of Git on the machine and reinstall the version needed. Seemed to work for me.

CodeJockey
  • 134
  • 6
1

If reinstalling Git doesn't help, there is another solution that I've found for a specific case.

If your project lies under a sub-directory of the main Git repository directory that has its own Git repository, deleting the repository in the sub-directory will fix the issue. This could be the case if you had a Git repository before and decided you wanted a different repository that had a larger scope than just the project you were working on and didn't delete the old Git repository files.

0

Restarting Visual Studio solved the problem for me
I am using Visual Studio 2019


Very General Advice (could or NOT be helpful to solve this specific problem)

  1. Update Git
  2. Update GitHub extension
  3. Update Visual Studio
Hakan Fıstık
  • 11,376
  • 8
  • 74
  • 105