重用Git子模块的子模块

Sta*_*ant 8 git repository git-submodules

我有一个Git项目.我们来说吧Proj.

Proj有两个子模块,LibUtils.

Lib也有子模块Utils.

现在问题是,当一个人想要时git clone --recursive Proj,他将需要下载Utils两次.当项目进展得更深时,情况可能会更糟.

那么如何Proj重新使用Utils已经下载的Lib

我的工作树:

Proj                      # Main project
+-- .git
`-- external
    +-- Lib               # Proj depends on Lib
    |   +-- .git
    |   `-- external
    |       `-- Utils     # Lib depends on Utils
    |           `-- .git
    `-- Utils             # Proj also depends on Utils
        `-- .git
Run Code Online (Sandbox Code Playgroud)

注意:

  1. 最好Utils留在external/Utils.

  2. 由于Windows兼容性,不允许使用符号链接.

如果有人能帮我解决这么复杂的问题,我将不胜感激.

Flo*_*sch 0

正如之前在这篇不错的程序员-stackexchange-post中提到的,下载两次内容的唯一方法是创建指向 git-submodule 的第一个实例的符号链接。