Handle multiple components in one or more Git repositories?

I have a large project based on .NET s> 20 with separate, different solutions, each of which represents different modules in a larger system. Within each decision there are a number of projects.

We are currently processing all the solutions in one Git repository, as they belong to each other, and this has worked just fine for us so far. Now, however, we wanted to start using the CI server, for example, for assembly and testing during modification. This, however, is where it begins to get hairy. I cannot create a CI server for a complete solution, but only to create a component that has been modified. In SVN, we could achieve this with a single repo and limit the various configurations of the CI server to listen to different paths — for example, “src / ModuleA” was one assembly and configuration, and “src / ModuleB” was different.

What are my options in Git and what will be considered best practice? What would be their pros and cons? I would like to draw attention to a larger open source solution with a similar setup as part of the answer.

  • Think I could have each module in my own repo? But this is a problem when it comes to hosting on GitHub, etc., And since they charge for repo ... Otherwise, is this the best option?
  • Will Git submodules work? Is this the right use for submodules?
  • Do you know of other options in CI products that somehow help in this scenario?
+4
source share
2 answers

I think I could have each module in my own repo? But this is a problem when it comes to hosting on GitHub, etc., And since they charge for repo ... Was this otherwise the best option?

This remains the best option unless this module is too interdependent, which means an additional hurdle when it comes to branch control (because you need to remember to split all or most of the modules at the same time, same thing for merging backwards)

If charging is a problem, remember that you can have a similar organization in BitBucket repositories (which offers free private repositories , albeit for a small team)

When you have each module in your git repository, you can combine them with a subtree or with submodules, as I explain in " Combine a base project that grows in a child of projects in a git repository, except for git submodules or subtree merge methods ."
git slave could also be a simpler alternative.

+2
source

Although the git submodule and git subtree are good (but different) solutions for managing subcomponents, they have some disadvantages

git submodule:

  • you get several repositories.
  • you need to manage each repository separately.
  • the user interface is confusing from time to time.

git subtree (I have not worked with it much, so my objections may be unfounded):

  • You have one story for the whole project. Although this works well and there is always a way to separate history, there is no easy way to compile arbitrary versions of components into a system.

I developed a git components method that works in a single repository (e.g. git subtree) and gives you the flexibility of independent component stories (e.g. git subodule).

The method is based on checking the path: checkout <branch_name> -- . (know the end point).

The method uses a simple manifest such as a bash script and imposes some naming conventions to facilitate component management.

Here you can find a full description of the method and implementation of toys:

https://github.com/picrin/git-components

change

As suggested by VonC , I tried to combine this with the new git function available with git 2.5 git worktree . Although 2.5 is not yet available (if you have not come here from the future), the very last wizard has a function, and it seems to work well.

The way that I propose to use git worktree with git components is to check the main working tree for mastering and create a working line for each component and each version of the system (clientA, clientB, etc.), Thus, you can work with each component at the same time, without forcing you to work on component 1 whenever someone interrupts you to make a quick fix for component 2.

+1
source

All Articles