Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to see what your changed in Visual Studio before you commit/push it to TFS? (Gui of Git Diff)

Using TFS-2013 with a project that is using git, is it possible to see the changes I made in Visual Studio 2013 Pro before I commit them? If so how?

Ie lets say I have /project

and i change line 32 of /project /foo.js

Is there a way It will show me what i changed on that line

In short I guess is there a visual way to do a Git Diff in visual studio I could just use Meld like i do on linux but there must be a good way to do this without leaving VS.

Microsoft Tools for Git looks awesome but its only for VS2012. Is there a main repo where I can find a similar plugin for 2013?

like image 278
Frank Visaggio Avatar asked Mar 18 '15 19:03

Frank Visaggio


People also ask

How do I see changes in Git Visual Studio?

As you do your work, Visual Studio keeps track of the file changes to your project in the Changes section of the Git Changes window. When you are ready to stage changes, click the + (plus) button on each file you want to stage, or right-click a file and then select Stage.

How do I see changes made in Visual Studio?

Visual Studio maintains a history of file changes. Modified files are marked with a red check mark in the Solution Explorer. You can compare your changes with the original file by right-clicking on the file name and selecting Compare with Unmodified. The Diff window shows new code in green and removed code in red.

How do I view commit history in Visual Studio?

Right-click the file in Solution Explorer and select View History. The Visual Studio History view will appear, showing the commits in your repo that updated the file. You can filter the commits to find the exact commit with the file version you want to restore. Double click on the version to open it in Visual Studio.

How do I push staged changes in Visual Studio?

When you stage a change, Visual Studio creates a Staged Changes section. Only changes in the Staged Changes section are added to the next commit, which you can do by selecting Commit Staged. The equivalent command for this action is git commit -m "Your commit message" .


1 Answers

Visual Studio 2013 has a built-in Git version control client. You'll find it on the "Team Explorer", at the bottom of the list of TFS projects. If you already have a local Git repository, simply add it using the add option. If you have access to a remote repository, but have not yet cloned it locally, you can clone it using the, you guessed it, clone option.

enter image description here

It should not be needed, but you may have to tell Visual Studio to turn on the "Visual Studio Git" provider or the "Team Foundation Server" provider. If you have other source control providers installed, like SourceSafe or SubVersion, they may hide this feature. To switch the source control provider, look under: Tools - Options - Source control - Plug-in Selection:

enter image description here

Visual Studio 2013 (as well as 2012) only support the http and https protocol to interact with a remote repository. ssh: and git: are not supported.

In the solution Explorer you can compare your current version to Unmodified:

enter image description here

The Git Diff Margin plugin provides additional information on local changes in the gutter of your source file:

enter image description here

And the Visual Studio 2013 ultimate feature "CodeLens" shows previous commits in the UI as well at the class and method level:

enter image description here

See also:

  • How to Connect Visual Studio 2012 with git (github)?
  • What are the big differences between TFS and Git for source control when using Visual Studio 2013?
  • Microsoft ALM Ranger Version Control Guidance - Git for TFVC users
like image 77
jessehouwing Avatar answered Oct 17 '22 18:10

jessehouwing