Is anyone really using git super/subprojects?

后端 未结 3 1287
无人及你
无人及你 2020-12-25 13:28

Is anyone using the new git super/subproject feature in real projects? How well does it work? For instance, I understand that if I push to a subproject I have to manually ca

3条回答
  •  囚心锁ツ
    2020-12-25 13:38

    FWIW, we are trying to make the leap to git, and our project (bitweaver, a content management system) is a highly modular system, with nearly 160 repositories). A "build" generally contains two dozen or more sub-repositories. We used 'virtual modules' in CVS, and this worked fantastically for us, however CVS has it's own limitations for staging commits.

    Git submodules have some severe limitations, and you should definitely evaluate mercurial's implementation as it is a certainly more friendly and flexible for external/modular projects (ie it supports other VCS systems, even HgGit).

    Here are the biggest challenges:

    1. Each submodule is hard linked to a particular commit when you "git submodule add" in the super-respository. This is by design, and sought as a benefit by git maintainers, so I would not expect it to change any time soon. This is painful in a system like ours where commit's are always happening in the submodules. You have to update the super project to keep up, or update your sub-repos to master after initial submodule update. (see supergit below for our solution).

    2. You cannot easily commit and push to all the sub-repo's from the root. This is also very annoying, see supergit below.

    3. Various gotchas that can be excruciating, especially things that "silently overwrite changes".

    supergit

    We've written a shell script call supergit that handles some of the painfulness. It does the clone, submodule init, update, and checkout master all in one fell swoop. It will also perform git commands to all directories in the super-repo individually (bulk git processing of sorts).

    HTH, good luck.

提交回复
热议问题