Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 279
Avrohom Yisroel Avatar asked May 09 '19 17:05

Avrohom Yisroel


People also ask

Does WinMerge work with Git?

Winmerge is installed. Git for windows is installed, from "git version 2.12. 0. windows1" or above (although earlier versions of git may have introduced the command).

How do I change the diff tool in Visual Studio?

In the displayed dialog box, select the Source Control → Visual Studio Team Foundation Server node. Click the Configure User Tools button to set up diff and merge tools. Click the Add button to add an external tool for comparison or merging.

What is WinMerge tool?

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.


1 Answers

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.

like image 101
aryeh Avatar answered Oct 06 '22 01:10

aryeh