我有.gitmodules中的子模块列表.我想下载一个特定的子模块,即只有在配置文件中启用某个选项为true时才下载grpc.因为我的构建有时不需要grpc.所有子模块都在第三方目录中.所以.gitmodules就像:
[submodule "third-party/libzip"]
path = third-party/libzip
url = https://github.com/nih-at/libzip.git
[submodule "third-party/sqlite"]
path = third-party/sqlite
url = https://github.com/mackyle/sqlite.git
branch = sqlite-3.23.1
[submodule "third-party/grpc"]
path = third-party/grpc
url = https://github.com/grpc/grpc.git
Run Code Online (Sandbox Code Playgroud)
还有一种方法可以在执行命令时专门排除子模块:
git submodule update --init --recursive
Run Code Online (Sandbox Code Playgroud)
我想在子模块更新时排除grpc中的grpc和子模块.就像是:
git submodule update --init --recursive "exclude third-party/grpc"
Run Code Online (Sandbox Code Playgroud)