Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practices Using Git with Visual Studio?

I'm considering migrating from Subversion to Git at work, and would like to get opinions about the best way to set up Git on Windows, and any problems that might arise from the combination of Visual Studio and Git.

The current setup is TortoiseSVN, with Visual Studio 2008 and AnkhSVN for .NET applications. The replacement would probably be Git Extensions.

Advice on repository layouts would be particularly appreciated. All of our solutions use multiple projects, and we now have a number of custom assemblies that we will need to share between applications. The current layout of our Subversion repositories definitely isn't optimal.

UPDATE: I've now migrated to Git using Git Extensions, and it's working very well. Shared code and assets live in separate repositories and are used as submodules. I found submodules slightly confusing when I started, and this post was very helpful.

like image 488
Stuart Ellis Avatar asked Sep 15 '09 10:09

Stuart Ellis


People also ask

Can you use Git with Visual Studio?

Git Repository window in Visual Studio 2019Visual Studio has a new Git Repository window, which is a consolidated view of all the details in your repository, including all of the branches, remotes, and commit histories. You can access this window directly from either Git or View on the menu bar or from the status bar.

How do I commit changes in Git using Visual Studio?

Just enter your commit message and then select Commit All. The equivalent command for this action is git commit -a . Visual Studio also makes it easy to commit and sync with one click by using the Commit All and Push and Commit All and Sync shortcuts.


2 Answers

The main Git installer for Windows is msysgit (SO question).
TortoiseGit is also a nice Windows integration (on top of msysgit).

You need to be aware of Git limits, particularly in term of Git repository (do not try to stuff every projects into one repo, unless you are building a "system", i.e. something which can only run with all its parts/components.)

External code dependencies are best represented with submodules.
Same thing for vendor branches.


Note also that, in addition of GitExtension, you now can define Git projects in TFS (Q1 2013):
See "How can I push my existing Git repository to Team Foundation Service": starting VS2012.2, yo have git commands directly from your IDE.

like image 185
VonC Avatar answered Sep 19 '22 21:09

VonC


We have a solution containing 9 projects & we're using git extensions (having come from the svn stack).

Three of the projects are shared with other solutions and we've used sub modules to reference them.

This just about works but the interface to it is very confusing. Going forward we're thinking of removing the sub modules and just referencing the dlls instead.

like image 25
Jon Spokes Avatar answered Sep 18 '22 21:09

Jon Spokes