Git 中子项目和子模块的区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7124483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between subprojects and submodules in Git?
提问by Justin ??????
In Git, is there a difference between a "submodule" (as created and managed by the git submodule command) and a "subproject" (literally just one Git repository that you put inside another Git repository), and if so, what is it?
在 Git 中,“子模块”(由 git submodule 命令创建和管理)和“子项目”(实际上只是您放入另一个 Git 存储库的一个 Git 存储库)之间是否有区别,如果有,它是什么?
All the documentation I've been able to find about this is rather ambiguous (and in some cases, contradictory). My suspicion is that there is no difference, but I figure I ought to confirm that and leave a question for Git newbies to find.
我能找到的所有关于此的文档都相当含糊(在某些情况下,相互矛盾)。我的怀疑是没有区别,但我想我应该确认这一点,并给 Git 新手留下一个问题。
回答by Justin ??????
A subprojectis a generic term for one of three types of nesting:
一个子项目是三种类型的嵌套的一个通用术语:
- Submodulesprovide semi-fixed references from the superproject into subprojects and are integrated into git. It is best used when the subproject:
- is developed by someone else, is not under the administrative control of the superproject and follows a different release cycle.
- contains code shared between superprojects (especially when the intention is to propagate bugfixes and new features back to other superprojects).
- separates huge and/or many files that would hurt performance of everyday git commands.
- Subtreescauses the subproject repository to be imported into the superproject's repository to be a native part of the repository with full history, typically in a specific subdirectory of the superproject.
- Wrappers, which provide multi-repository management functionality to a superproject with associated subprojects.
- 子模块提供从超级项目到子项目的半固定引用,并集成到 git 中。最好在子项目时使用:
- 由其他人开发,不受超级项目的管理控制,并且遵循不同的发布周期。
- 包含在超级项目之间共享的代码(特别是当意图将错误修正和新功能传播回其他超级项目时)。
- 分离会影响日常 git 命令性能的巨大和/或许多文件。
- Subtrees使子项目存储库导入到超级项目的存储库中,成为具有完整历史记录的存储库的本机部分,通常位于超级项目的特定子目录中。
- Wrappers,为具有关联子项目的超级项目提供多存储库管理功能。