简体   繁体   中英

Reuse Git submodule's submodule

I have a Git project. Let's name that Proj .

Proj has two submodules, Lib and Utils .

Lib also has the submodule Utils .

Now the problem is, when one wants to git clone --recursive Proj , he will need to download Utils twice. When the project grows deeper, the situation may be worse.

So how can I make Proj reuse the Utils already downloaded by Lib ?

My working tree:

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

Note:

  1. It is better that Utils stays at external/Utils .

  2. Due to Windows compatibility, symlinks are not allowed.

I will appreciate it if anyone can help me with such a complicated question.

如前所述,在这个很好的程序员-stackexchange-post中 ,唯一的方法是两次下载内容,即创建到git-submodule的第一个实例的符号链接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM