Profile picture

Git Pull With Submodule

Profile picture

Raphael Tang / June 18, 2022

1 min read


For a repo with submodules, we can pull all submodules with

git submodule update --init --recursive

for the first time. All submodules will be pulled down locally.

To update submodules, we can use

For git **1.8.2** or above, the option --remote was added to support updating to latest tips of remote branches
git submodule update --recursive --remote

This has the added benefit of respecting any "non default" branches specified in the .gitmodules or .git/config files.

For git 1.7.3 or above you can use

git submodule update --recursive

or simply

git pull --recurse-submodules


For a repo with no pulled submodules yet, do

git submodule update --init --recursive

To update submodules, do

git submodule update --recursive --remote

1. [Easy way to pull latest of all git submodules](

Subscribe to the newsletter

Get emails from me about software development, SaaS, and early access to new articles.