The diff tool in Visual Studio when using the Git Plugin
Asked Answered
R

2

24

Microsoft has released a Git plugin for Visual Studio 2012. I have found it to be excellent, but there doesn't seem to be any option to change the default Diff tool. Worse, I cannot do a diff at all on ascx codebehind files. It only shows a diff option for the main .ASCX file.

How do you

  1. Diff the codebehind files when using the git plugin?
  2. Change the diff tool?
Ragout answered 21/5, 2013 at 16:4 Comment(0)
L
35

You have to change your local .gitconfig, rather than make the change through Visual Studio as you would with TFS

https://gist.github.com/mkchandler/2377564

Add the following to your global .gitconfig file:

[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = \"C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    cmd = \"C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe\" -merge -result=\"$PWD/$MERGED\" \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\"
    trustExitCode = true
[mergetool]
    keepBackup = false
Leuco answered 8/6, 2013 at 14:26 Comment(2)
+1 Perfect-o! This is exactly what I was looking for. And lookie there, it opens up from command-line now too!Fiore
The .gitconfig is located in the User/[UserName]/ root folder as metioned in the link providedAlla
L
15

Steps :

  1. Install Winmerge with "WinMerge added to your PATH environment variable", you have to select the check box during winmerge installation.

  2. Microsoft GIT provider plugin should be installed in visual studio 2013.

  3. Go to user git config, generally in "C:\Users\USERNAME\.gitconfig"

  4. Add the following lines or update according to parameters inside .gitconfig

**

[diff]
    tool = winmerge
[difftool "winmerge"]
  cmd = winmergeu.exe -e -ub -x -wl -u -maximise -dl "base" -dr "mine" \"$LOCAL\" \"$REMOTE\"
[difftool]
  prompt = false

**

Now from Visual studio if you do "Compare with Unmodified..." on a file winmerge should open up automatically.

Lajuanalake answered 5/8, 2014 at 0:21 Comment(1)

© 2022 - 2024 — McMap. All rights reserved.