[英]git common submodule of submodule
I have an application main
which consists of multiple submodules A
, B
and utility_functions
: Both of these submodules A
and B
by itself include the submodule utility_functions
. 我有一个由多个子模块
A
, B
和utility_functions
组成的应用程序main
:这两utility_functions
模块A
和B
本身都包含子模块utility_functions
。
main
|
|---- A
| |
| |---- utility_functions
|
|---- B
| |
| |---- utility_functions
|
|---- utility_functions
Right now I have the utility_functions
three times in my project. 现在,我的项目中有3次
utility_functions
了。 Usually sub_A
, sub_B
and main
should all point to the same commit of utility_functions
. 通常
sub_A
, sub_B
和main
应该都指向同犯的utility_functions
。
It is necessary that the code from the repository A
is run-able by itself. 来自存储库
A
的代码本身A
是可运行的。 If I only clone A
it should include my utility_functions
如果仅克隆
A
,则应包含我的utility_functions
A
|
|---- utility_functions
Is there a way to only tell my submodules included in the main repository to rely on the same utility_functions
? 有没有办法只告诉我包含在主存储库中的子模块依靠相同的
utility_functions
? Or does this break the idea of submodules because they can point to different commits? 还是因为子模块可以指向不同的提交而打破了子模块的想法? Or is this simply a bad idea?
还是这只是一个坏主意?
main
|
|---- A
| |
| |----
| |
|---- B |
| | |
| | |
| | |
|---- utility_functions
Or does this break the idea of submodules because they can point to different commits?
还是因为子模块可以指向不同的提交而打破了子模块的想法?
Yes, that wouldn't be practical precisely because of that reason. 是的,正是由于这个原因,这是不实际的。
If you are sure that A
and B
should always reference the same version of utility_functions
, then clone your main repo and update only A
, B
and utility_functions
(without the recursive option), and make a symlink from A/utility_functions
and B/utility_functions
to ../utility_functions
. 如果确定
A
和B
始终引用相同版本的utility_functions
,则克隆主仓库并仅更新A
, B
和utility_functions
(无递归选项),并从A/utility_functions
和B/utility_functions
进行符号链接到../utility_functions
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.