。gitmodules选项,以忽略子模块中的子模块

问题描述 投票:0回答:1

我有一个git存储库,其子模块层次类似于此:

TopLevelRepo
+- .gitmodules # this is where I want the configuration
+- externals
   +- RepoA # this is a 3rd party repository and I cannot modify it
   |  +- externals
   |     +- RepoB # this repository is not necessary and is very large
   |     +- RepoC # this repository is required
   +- RepoD
   +- dozens more repositories

我克隆存储库的方式是其中之一:

git clone --recursive https://github.com/TopLevelRepo TopLevelRepo
# or
git clone https://github.com/TopLevelRepo TopLevelRepo
cd TopLevelRepo
git submodules update --init --recursive

是否可以添加到.gitmodules(或其他任何已签入到存储库的文件中的选项),使我可以跳过(避免克隆)RepoB,但保留RepoC?

我已经找到了:Exclude submodule of a submodule这显然可以满足我的要求,但是我需要将其存储在顶层存储库中。

谢谢。

git configuration git-submodules
1个回答
1
投票
否,顶级超级项目无法管理子子模块,只有直接父级可以。尝试这样的事情:

git clone https://github.com/TopLevelRepo TopLevelRepo cd TopLevelRepo git submodules update --init RepoA cd RepoA git config submodule.RepoB.update none cd ../.. # back to TopLevelRepo git submodules update --init --recursive

© www.soinside.com 2019 - 2024. All rights reserved.