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.
source share