Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The diff tool in Visual Studio when using the Git Plugin

Tags:

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?
like image 964
JosephStyons Avatar asked May 21 '13 16:05

JosephStyons


People also ask

How do I see the Git diff code in Visual Studio?

Our Git tooling supports viewing of diffs within VS Code. Tip: You can diff any two files by first right clicking on a file in the Explorer or OPEN EDITORS list and selecting Select for Compare and then right-click on the second file to compare with and select Compare with 'file_name_you_chose'.

How does Git integrate with Visual Studio?

The new Git experience is the default version control system in Visual Studio 2019 from version 16.8 onwards. However, if you want to turn it off, you can. Go to Tools > Options > Environment > Preview Features and then toggle the New Git user experience checkbox, which will switch you back to Team Explorer for Git.

How do I see the difference between two branches in Visual Studio?

To compare your currently checked out branch with other branches using Visual Studio, you can utilize the branch picker hosted in the status bar and the Git changes tool window to choose any local or remote branch to compare with. Right click the branch you are targeting and select Compare with Current Branch.

How do I get the Git menu in Visual Studio?

Adding the GIT menu in VS 2019 Community Edition We will open Visual Studio 2019 Community Edition and select “Extensions-> Manage Extensions” from the top menu. Then, select “Online-> Visual Studio Marketplace” and search for “GIT”.


2 Answers

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 
like image 94
kenwarner Avatar answered Sep 28 '22 16:09

kenwarner


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.

like image 40
Saket Avatar answered Sep 28 '22 15:09

Saket