Brad Robinson Brad Robinson - 1 year ago 79
Git Question

Easy way pull latest of all submodules

We're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependant project as a submodule. During development, we often want to just go grab the latest version of every dependant submodule.

Does git have a built in command to do this? If not, how about Windows batch file or similar that can do it.

Answer Source

For git 1.7.3 or above you can use:

git submodule update --recursive

If that's the first time you checkout a repo you need to use --init too:

git submodule update --init --recursive

For older, git 1.6.1 or above you can use something similar to (modified to suit):

git submodule foreach git pull origin master

See git-submodule(1) for details