使用包含子模块的 git 拉取
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8090761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pull using git including submodule
提问by adit
In one of my iOS project I have add a sub-module added, lets say a friend of my wants to pull it including the submodule, how can he do this? Whenever I tried to download the zip file from github it doesn't pull the submodule along with it
在我的一个 iOS 项目中,我添加了一个子模块,假设我的一个朋友想拉它包括子模块,他怎么能做到这一点?每当我尝试从 github 下载 zip 文件时,它都不会同时拉取子模块
回答by Dietrich Epp
That's by design. Get the submodules as a second step.
那是设计使然。第二步获取子模块。
git clone git://url...
cd repo
git submodule init
git submodule update
Then afterwards, add another step after the git pull
.
然后,在 之后添加另一个步骤git pull
。
git pull ...
git submodule update --recursive
Of course, this only works if the submodules are set up correctly in the first place...
当然,这只有在子模块首先正确设置的情况下才有效......
回答by Mark Longair
You can clone with the --recursive
option in order to automatically initialize and update the submodules (and any submodules that those submodules contain, etc.)
您可以使用该--recursive
选项进行克隆,以便自动初始化和更新子模块(以及这些子模块包含的任何子模块等)
git clone --recursive <URL-OF-REPOSITORY>