If I have a C# solution with multiple projects in it, what would be better, to have the Git repo created in the solution folder, or in each individual project folder? Multiple developers will be working on the projects. What are your experiences with this?
如果我有一个包含多个项目的C#解决方案,那么在解决方案文件夹或每个单独的项目文件夹中创建Git仓库会更好吗?多个开发人员将致力于这些项目。你有什么经历?
5 个解决方案
#1
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.
我使用了几个(有时是重叠的)解决方案来包含一组相关的独立应用程序和共享库。正如其他人所提到的,你真的不希望有一个包含多个独立项目源的Git存储库,因为它很难跟踪孤立的更改。
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.
因此,如果您的解决方案是按我的方式构建的,那么您肯定需要为每个项目提供单独的Git存储库。这对我来说效果很好,适用于十到十二个应用程序,并且不会产生与您想象的相同的维护开销。
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.
如果您的解决方案真的是单一的(并且您确定您希望永远这样),那么只有一个存储库可能是有意义的。
#2
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存储库最适合包含单个配置项及其独立的生命周期。如果您的项目有自己的发布周期并在多个解决方案之间共享,那么将它们放在自己的存储库中可能是有意义的。但是,通常,它是表示配置项的解决方案,其中所有组成项目构成同一构建的一部分。在这种情况下,解决方案级别的单个git存储库更有意义。
#3
git submodule is probably worth consideration here. Each project gets it's own repo, the solution gets a repo, and the projects are submodules.
git子模块在这里可能值得考虑。每个项目都有自己的仓库,解决方案获得一个仓库,项目是子模块。
#4
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.
在这种情况下,我将在解决方案级别创建存储库。这样,一次构建整个产品就容易多了,特别是如果项目相互依赖的话。
#5
Some though and 3 solutions on the subject can be read on that blog: http://blogs.atlassian.com/2014/04/git-project-dependencies/
关于这个主题的一些解决方案可以在该博客上阅读:http://blogs.atlassian.com/2014/04/git-project-dependencies/
- package management tool, i.e. nuget in VS, so using reference to a package/compiled module
- git submodule (only with command line in VS?)
- other build and cross-stack dependency tools
包管理工具,即VS中的nuget,因此使用对包/编译模块的引用
git submodule(只有VS中的命令行?)
其他构建和跨堆栈依赖工具
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.
另一个解决方案是从其他仓库添加一个项目并将其从当前仓库中取出,后者使用团队资源管理器提交其更改。
#1
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.
我使用了几个(有时是重叠的)解决方案来包含一组相关的独立应用程序和共享库。正如其他人所提到的,你真的不希望有一个包含多个独立项目源的Git存储库,因为它很难跟踪孤立的更改。
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.
因此,如果您的解决方案是按我的方式构建的,那么您肯定需要为每个项目提供单独的Git存储库。这对我来说效果很好,适用于十到十二个应用程序,并且不会产生与您想象的相同的维护开销。
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.
如果您的解决方案真的是单一的(并且您确定您希望永远这样),那么只有一个存储库可能是有意义的。
#2
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存储库最适合包含单个配置项及其独立的生命周期。如果您的项目有自己的发布周期并在多个解决方案之间共享,那么将它们放在自己的存储库中可能是有意义的。但是,通常,它是表示配置项的解决方案,其中所有组成项目构成同一构建的一部分。在这种情况下,解决方案级别的单个git存储库更有意义。
#3
git submodule is probably worth consideration here. Each project gets it's own repo, the solution gets a repo, and the projects are submodules.
git子模块在这里可能值得考虑。每个项目都有自己的仓库,解决方案获得一个仓库,项目是子模块。
#4
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.
在这种情况下,我将在解决方案级别创建存储库。这样,一次构建整个产品就容易多了,特别是如果项目相互依赖的话。
#5
Some though and 3 solutions on the subject can be read on that blog: http://blogs.atlassian.com/2014/04/git-project-dependencies/
关于这个主题的一些解决方案可以在该博客上阅读:http://blogs.atlassian.com/2014/04/git-project-dependencies/
- package management tool, i.e. nuget in VS, so using reference to a package/compiled module
- git submodule (only with command line in VS?)
- other build and cross-stack dependency tools
包管理工具,即VS中的nuget,因此使用对包/编译模块的引用
git submodule(只有VS中的命令行?)
其他构建和跨堆栈依赖工具
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.
另一个解决方案是从其他仓库添加一个项目并将其从当前仓库中取出,后者使用团队资源管理器提交其更改。