Using Git with Visual Studio
18
As a long-time Visual SourceSafe user (and hater) I was discussing switching to SVN with a colleague; he suggested using Git instead. Since, apparently, it can be used as peer-to-peer without a central server (we just have a 3-developer team). 

I have not been able to find anything about tools that integrate Git with Visual Studio, though - does such a thing exist? 

If not, can anyone report on their experiences using Git with Visual Studio?
improve this question | comment
Titus Fadel Created at: 2013-11-13 17:07:08 UTC By Titus Fadel
I just added the Git Source Control Provider for VS 2010, so it still works. - Mr. Ryann Dietrich
Checkout this tutorial from VS team. The next update; Update 2 for VS 2012 is coming any day now. You can also download the community technology preview (CTP) for VS2012 from here. Alternatively, if you are into CMMI, Agile, Scrum 1/2 etc. you can signup for free account (both public or private cloud instances) & invite members (teammates, clients) to ur project on web-based TFS tfs.visualstudio.com - Daphnee Spencer
+1 for hating VSS ;-) - Tobin Russel
14 Answers
0
Visual Studio 2013 natively supports Git.

See the official announcement.
0
Git Source Control Provider is new plug-in that intgrates Git with Visual Studio.

http://gitscc.codeplex.com
0
The simplest solution that actually works quite well is to add the TortoiseGit commands as external tools. 

Solution to adding a Git (TortoiseGit) toolbar to Visual Studio
0
The newest Release of Git Extensions supports VS 2010 now (along with 2008 and 2005).
I found it to be fairly easy to use with 2008 and the Interface seems to be the same in VS 2010.
0
In Jan 2013, Microsoft announced that they are adding full Git support into all their ALM products. They have published a plugin for Visual Studio 2012 that adds Git source control integration.

Alternatively, there is a project called Git Extensions that includes add-ins for Visual Studio 2005, 2008, 2010 and 2012, as well as Windows Explorer integration. It's regularly updated and having used it on a couple of projects, I've found it very useful.

Another option is Git Source Control Provider.
0
As mantioned by Jon Rimmer, you can use GitExtensions. GitExtensions does work in Visual Studio 2005 and Visual Studio 2008, it also does work in Visual Studio 2010 if you manually copy and config the .Addin file. 
0
I use Git with Visual Studio for my port of Protocol Buffers to C#. I don't use the GUI - I just keep a command line open as well as Visual Studio.

For the most part it's fine - the only problem is when you want to rename a file. Both Git and Visual Studio would rather that they were the one to rename it. I think that renaming it in Visual Studio is the way to go though - just be careful what you do at the Git side afterwards. Although this has been a bit of a pain in the past, I've heard that it actually should be pretty seamless on the Git side, because it can notice that the contents will be mostly the same. (Not entirely the same, usually - you tend to rename a file when you're renaming the class, IME.)

But basically - yes, it works fine. I'm a Git newbie, but I can get it to do everything I need it to. Make sure you have a git ignore file for bin and obj, and *.user.
0
I just want to point out that as of Feb 11, 2013, the MS Git plugin for VS 2012 should work with the Express version as well.
0
I've looked into this a bit at work (both with Subversion and Git). Visual Studio actually has a source control integration API to allow you to integrate third party source control solutions into VS. However, most folks don't bother with it for a couple of reasons.

The first is that the API pretty much assumes you are using a locked-checkout workflow. There are a lot of hooks in it that are either way expensive to implement, or just flat out make no sense when you are using the more modern edit-merge workflow.

The second (which is related) is that when you are using the edit-merge workflow that both Subversion and Git encourage, you don't really need Visual Studio integration. The main killer thing about SourceSafe's integration with VS is that you (and the editor) can tell at a glance which files you own, which must be checked out before you can edit, and which you cannot check out even if you want to. Then it can help you do whatever revision-control voodoo you need to do when you want to edit a file. None of that is even part of a typical Git workflow. 

When you are using Git (or SVN typically), your revision-control interactions all take place either before your development session, or after it (once you have everything working and tested). At that point it really isn't too much of a pain to use a different tool. You aren't constantly having to switch back and forth.
0
I find that git, working on whole trees as it does, benefits less from ide integration than source control tools that are either file based or follow a checkout-edit-commit pattern. Of course there are instances when it can be nice to click on a button to do some history examination but I don't miss that very much.

The real must-do is to get your .gitignore file full of the things that shouldn't be in a shared repository. Mine generally contain (amongst other stuff) the following:

*.vcproj.*.user
*.ncb
*.aps
*.suo


but this is heavily C++ biased with little or no use of any class wizard style functionality.

My usage pattern is something like the following.

1) Code, code, code in VS.

2) When happy (sensible intermediate point to commit code, switch to git, stage changes and review diffs. If anything's obviously wrong switch back to VS and fix, otherwise commit.

Any merge, branch, rebase or other fancy SCM stuff is easy to do in git from the command prompt. VS is normally fairly happy with things changing under it, although it can sometimes need to reload some projects if you've altered the project files significantly.

I find that the usefulness of git outweighs any minor inconvenience of not having full IDE integration but it is, to some extent, a matter of taste.
0
Also don't miss TortoiseGIT ... 
  http://code.google.com/p/tortoisegit/
0
Microsoft announced Git for Visual studio 2012 (Update 2) recently. I have not played around with it yet but this video looks promising.

Here is a quick tutorial on how to use Git from VS 2012.
0
There's a Visual Studio Tools for Git by Microsoft. Only supports VS2012 (Update 2) though.
0
TortoiseGit has matured and I recommend it especially if you have used TortoiseSVN.
Your Answer