Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting WinMerge as Diff/merge tool in Visual Studio 2015

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
like image 276
Padzonk Avatar asked Dec 09 '15 12:12

Padzonk


2 Answers

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\"
like image 195
gezzahead Avatar answered Oct 25 '22 00:10

gezzahead


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"
like image 28
mlhDev Avatar answered Oct 24 '22 23:10

mlhDev