Heath SchweitzerHeath Schweitzer
← All posts

Updating git submodules

May 15, 2014|Heath Schweitzer|1 min read|30 views|Last Updated May 24, 2026

LinuxMac

If you want to update git submodules, you will need to do this directly in your submodules directory

# download the submodule
git submodule add https://user@repourl/reponame.git submodule_dir/

# initialize the submodule
git submodule init
# update your submodule
cd submodule_dir/
git checkout master 
# or git checkout mybranch
git pull

# commit the submodule update from root directory
cd ../
git commit -am "update submodule_dir to commit Abc123"

Or if you like shortcuts:

git submodule foreach git pull origin master

If this post was useful, consider buying me a coffee ☕ with ₿itcoin — no account needed, any amount welcome.

Bitcoin tip QR code
⚡ Open in Wallet