Skip to content

Instantly share code, notes, and snippets.

@ryannealmes
Created August 27, 2015 13:52
Show Gist options
  • Select an option

  • Save ryannealmes/aa4eed8b222239c9e207 to your computer and use it in GitHub Desktop.

Select an option

Save ryannealmes/aa4eed8b222239c9e207 to your computer and use it in GitHub Desktop.
Update Git submodule to latest commit on origin
# get the submodule initially
git submodule add ssh://bla submodule_dir
git submodule init
# time passes, submodule upstream is updated
# and you now want to update
# change to the submodule directory
cd submodule_dir
# checkout desired branch
git checkout master
# update
git pull
# get back to your project root
cd ..
# now the submodules are in the state you want, so
git commit -am "Pulled down update to submodule_dir"
Credit to:
http://stackoverflow.com/questions/5828324/update-git-submodule-to-latest-commit-on-origin
@ryannealmes

Copy link
Copy Markdown
Author

git submodule update gets all submodules for a repo.

@ryannealmes

Copy link
Copy Markdown
Author

git submodule foreach git pull origin master

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