Should Git Repo's be at the Solution Level or Project Level in Visual Studio

I use several (sometimes over-lapping) solutions to contain a collection of related independent applications and shared libraries. As others have mentioned, you really don't want to have a single Git repository containing the source for multiple, independent projects as it makes it much too difficult to track isolated changes.

So, if your solution is structured as mine is then you will definitely want individual Git repositories for each project. This has worked well for me for ten to twelve applications and doesn't create as much maintenance overhead as you might think.

If your solution is truly monolithic (and your sure you want it that way forever and ever), then it probably makes sense to only have a single repository.


It depends. git repositories are most suited to containing a single configuration item with it's own independent lifecycle. If your projects have there own release cycle and are shared between multiple solutions then it might make sense to have them in their own repositories. Usually, though, it is the solution that represents a configuration item with all the constituent projects forming part of the same build. In this case a single git repository at the solution level makes more sense.


git submodule is probably worth consideration here. Each project gets it's own repo, the solution gets a repo, and the projects are submodules.


I assume that your solution represents some kind of a product while the projects are just a part of the product.

In this situation I would create the repository on the solution level. This way it is a lot easier to build the whole product at once, especially if the projects depend on each other.


Some though and 3 solutions on the subject can be read on that blog: https://www.atlassian.com/blog/git/git-and-project-dependencies

  1. package management tool, i.e. nuget in VS, so using reference to a package/compiled module
  2. git submodule (only with command line in VS?)
  3. other build and cross-stack dependency tools

Another solution is just to add a project from the other repo and let it out of the current repo, and latter use the Team Explorer to commit its changes.