How should I structure my Git repositories with my .NET Solution?

.net, branching-and-merging, git

Solution

The git repository should contain everything needed. That is, cloning a respository should bring down everything needed to work with it.

That said, if the projects are self-contained enough to stand on their own; give them a repository of their own. They can then be brought into the solution as either a submodule (if code is needed while working on the solution) or as a compiled dll (if just the functionality is needed).

Problem

I have a .NET solution that has, let's say, 10 projects within it. There are a couple ways of thinking: - Use a Git repository per project, then use a repository for the solution and submodules. So, each `.csproj` file and dependent file gets its own repository. - Use a single Git repository for the entire solution. Everything the `.sln` file depends upon. Looking at option #1, I think would be tough as if you are working on a feature branch, you have to create a feature branch for every referenced submodule. It creates a lot of overhead. Option #2 seems easier to deal with branching, however, with a large number of developers on a project, you may run into quite a bit of merge conflicts, especially when dealing with the `.csproj` files. How do other .NET developers manager their Git repositories with their various solutions.

Original source