Setting WinMerge as Diff/merge tool in Visual Studio 2015
Asked Answered
D

3

8

I want to set WinMerge as default diff tool in VS 2015, and i cant do it globally. I need to edit my local ([solution dir]/.git/config) file, and it works perfectly, but when i try to do it globally editing file ([User folder]/.gitconfig) it doesnt work in VS 2015 (standard VS diff tool is used). Its a bit annoying to apply that settings every time i add new solution to Git.

Here's my config

[diff]
tool = winmerge
[difftool]
prompt = true
[difftool "winmerge"]
path = d:\\WinMerge\\winmergeu.exe
cmd = \"d:\\WinMerge\\WinMergeU.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
tool = winmerge
[mergetool]
prompt = true
[mergetool "winmerge"]
path = d:\\WinMerge\\winmergeu.exe
cmd = \"d:\\WinMerge\\winmergeu.exe\" -u -e -dl \"Local\" -dr \"Remote\" $LOCAL $REMOTE $MERGED
Donnelly answered 9/12, 2015 at 12:39 Comment(3)
What about git config merge.tool winmerge ?Leontineleontyne
Just have tried it. Doesn't work.Donnelly
Have you tried adding guitool = winmerge under [diff]? That is the only difference I can see compared to my config, which works at least with older VS version (I have Git Extensions plugin though). If the call to git difftool has option --gui, Git looks for diff.guitool instead of diff.tool.Eisenberg
P
13

I have VS2015 SP1 and WinMerge on my path, nothing set in my solution .git/config and the following in .gitconfig (under C:\users\username), and it is working:

[diff]
    tool = winmerge
[difftool "winmerge"]
    cmd = winmergeu.exe -e -ub -x -wl -u -maximise -dl "base" -dr "mine" \"$LOCAL\" \"$REMOTE\"
Paresis answered 23/2, 2016 at 10:51 Comment(1)
So I just realized that for those using VS 2017, click the Merge button in the Team Explorer will bring up a new VS included diff tool to resolve conflicts.Handsaw
P
2

In addition to what @gezzahead said (and I added a guitool entry just for good measure), I discovered that the domain policy I was in created two "home" directories and consequently two .gitconfigs - a) the windows default of C:\users\jsmith\.gitconfig and H:\.gitconfig (my H: drive is a mapped drive to what IT call my "home folder").

After I created a symlink using something like the below (you'll need to edit it), Visual Studio brought up WinMerge.

mklink H:\.gitconfig C:\users\jsmith\.gitconfig

Just for completeness, I was running Win10 x64, VS 2015 update 2, and below is a listing of my config (slightly censored)

PS> git config --global --list
user.name=John Smith
[email protected]
diff.tool=winmerge
diff.guitool=winmerge
difftool.winmerge.path=c:/Program Files (x86)/winmerge/winmergeu.exe
difftool.winmerge.cmd=winmergeu.exe /e /x /u /wl /maximize -dl base -dr mine "$LOCAL" "$REMOTE"
Planarian answered 29/6, 2016 at 13:35 Comment(0)
G
0

The solution with .gitconfig works as magic (VS 2015). However, windows explorer refuses to rename the file to .gitconfig. I used command prompt rename.

ren aaa ".gitconfig"

No Visual Studio restart is required.

Guthrey answered 18/5, 2016 at 17:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.