If it's the first time you checkout a repo you need to use --init
first:
(如果这是您第一次签出--init
需要先使用--init
:)
git submodule update --init --recursive
For git 1.8.2 or above the option --remote
was added to support updating to latest tips of remote branches:
(对于git 1.8.2或更高--remote
,添加了--remote
选项以支持更新到远程分支的最新提示:)
git submodule update --recursive --remote
This has the added benefit of respecting any "non default" branches specified in the .gitmodules
or .git/config
files (if you happen to have any, default is origin/master, in which case some of the other answers here would work as well).
(这具有.gitmodules
或.git/config
文件中指定的任何“非默认”分支的附加好处(如果碰巧有任何分支,默认为origin / master,在这种情况下,此处的其他一些答案也可以作为好)。)
For git 1.7.3 or above you can use (but the below gotchas around what update does still apply):
(对于git 1.7.3或更高版本,您可以使用(但是有关更新的以下陷阱仍然适用):)
git submodule update --recursive
or:
(要么:)
git pull --recurse-submodules
if you want to pull your submodules to latest commits intead of what the repo points to.
(如果您想将子模块拉到最新版本,例如仓库指向的内容。)
See git-submodule(1) for details
(详见git-submodule(1))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…