Git update submodules recursively

complez picture complez · Apr 16, 2012 · Viewed 268.1k times · Source

My project struture

ProjectA
-FrameworkA (submodule)
--Twig (submodule of FrameworkA)

How I can update submodules recursively? I already tried some git commands (on ProjectA root)

git submodule foreach git pull origin master

or

git submodule foreach --recursive git pull origin master

but cannot pull files of Twig.

Answer

drewag picture drewag · Apr 16, 2012
git submodule update --recursive

You will also probably want to use the --init option which will make it initialize any uninitialized submodules:

git submodule update --init --recursive

Note: in some older versions of Git, if you use the --init option, already-initialized submodules may not be updated. In that case, you should also run the command without --init option.