我有一个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 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