Alternatives to Git Submodules?

后端 未结 5 1368
渐次进展
渐次进展 2020-11-29 19:05

I feel that using Git submodules is somehow troublesome for my development workflow. I\'ve heard about Git subtree and Gitslave.

  • Are there more tools out ther
5条回答
  •  死守一世寂寞
    2020-11-29 19:18

    For some use cases, I have liked each of the following two simple approaches:

    • Nested repositories. If your software project has a plugin mechanism, with each plugin in its own sub-directory, it can make sense to git-ignore these plugin directories and, in your local filesystem, to make each of them into its own git repository. This way, all your files form a single directory tree, but are managed in different git repositories. It will not confuse git.

    • Per-package repositories. For software projects where you use some kind of source code package management system (gem / bundler, npm, pear or the like) it can make sense to put your re-used code into separate git repositories, then to make source packages from them, and then to install them with the package management tool into the parent project. Your parent project's git repository would only contain a reference to the required packages and their versions, while the actual code of these packages will be git-ignored as done with all other packages and external libraries as well. Compared to the nested repositories proposed above, this is a more elaborate approach as it allows to specify which package version is to be installed.

提交回复
热议问题