Skip to content

Instantly share code, notes, and snippets.

@iissnan
Last active December 30, 2015 21:29
Show Gist options
  • Save iissnan/7887727 to your computer and use it in GitHub Desktop.
Save iissnan/7887727 to your computer and use it in GitHub Desktop.
Update git submodule.

You can use git submodule foreach to handle a batch of submodules:

git submodule foreach git pull origin master

Or, update submodule one by one:

# go to submodule directory and update to latest.
cd {{submodule}}
git pull origin master

Finally, stage the modification for the update of submodule and commit(and push):

# back to main project directory
cd .. 
git add {{submodule}} {{submodule}} ...
git ci -m "Update submodule"

DONE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment