- Git-submodule reference
- Git Tools | Submodules
- Git Submodules: Adding, Using, Removing, Updating
- Remove a Git Submodule
- Update Git submodule to latest commit on origin
- Git update submodules recursively
git clone --recurse-submodules <repository>Update submodules recursively (and/or initialize them if you haven't yet):
git submodule update --recursive
git submodule update --init --recursiveUpdate submodule to a later upstream commit:
- Change directory to the submodule's subdirectory.
- Checkout desired branch or commit.
- Update.
- Get back to your project root
- Make a commit for the changes
cd submodule_dir
git checkout master
git pull
cd ..
git commit -am "Pulled down update to submodule_dir"... Or, if you're a busy person:
git submodule foreach git pull origin masterAdd a submodule at <repository>, place it at <path> in this repository, and initialize it:
git submodule add <repository> [<path>]
cd <path>
git submodule init- Delete the relevant line from the .gitmodules file.
- Delete the relevant section from .git/config.
- Run
git rm --cached pathtosubmodule(no trailing slash). - Commit the superproject.
- Delete the now untracked submodule files.