How do I tell Visual Studio to use WinMerge with Git?
Asked Answered
H

1

12

I'm using Git with VS2017 Enterprise, and if I right-click a file in Changes and choose "Compare with unmodified" it opens in a new window in VS using the VS diff tool.

I would like to use WinMerge instead, and have been looking at resources such as this (instructions for BeyondCompare, but the principle should be the same), this (ditto for GitExtensions) and this, but cannot get it to work. Whatever I do, I still get the VS diff tool in VS.

The .gitconfig file in my user folder looks like this...

[user]
  name = Me
  email = [email protected]
[core]
  autocrlf = true
[diff]
  tool = winmerge
[difftool "winmerge"]
  cmd = "'C:/Program Files (x86)/WinMerge/WinMergeU.exe'" -e "$LOCAL" "$REMOTE"

...and the .git/config file in my project folder looks like this (sensitive info changed)...

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[user]
[diff]
    tool = winmerge
[difftool]
    prompt = true
[difftool "winmerge"]
    cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE
    keepBackup = false
[merge]
    tool = vsdiffmerge
[mergetool]
    prompt = true
[remote "origin"]
    url = https://[email protected]/me/Project/_git/Project
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[gui]
    wmstate = normal
    geometry = 1346x938+75+75 445 196

Anyone able to tell me what I need to do to use WinMerge?

  • Windows 7 Pro 64-bit
  • Visual Studio 2017 Enterprise 4.7.03062
  • WinMerge 2.14.0.0
  • Git 2.21.0
Honeywell answered 9/5, 2019 at 17:24 Comment(3)
In your project's config, I see that tool under merge is set to vsdiffmerge. Maybe try setting that to winmerge instead? Not sure if that will work though.Radiocommunication
@Radiocommunication Didn't make any difference. Thanks anywayHoneywell
Anyone any ideas?Honeywell
T
6

Your problem is that...

/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe

...is an incorrect path. If you look in your first code snippet, you'll see the correct path, however this is overridden by the project's config file.

If you change the path in the second snippet, or (better still) remove that whole section, as it only duplicates what's in the first, then you should find it will work.

Thomajan answered 22/5, 2019 at 13:46 Comment(1)
Duh, obvious when you see it! ThanksHoneywell

© 2022 - 2024 — McMap. All rights reserved.