Git submodules allow you to include a Git repository within another Git repository. This can be useful for organizing and sharing dependencies or code between multiple projects.
To update all submodules to their latest changes, you can use the following steps:
cd <repo_root>
git submodule update --remote
git commit -m "Update submodules"
git submodule foreach git checkout HEAD
After these steps, your submodules will be updated to the latest changes in their respective remote repositories. Note that you may need to repeat these steps if changes are made to the submodules in the future.
There are some alternate way to pull all latest in git sub modules
If it's the first time you check-out a repo you need to use --init
first:
git submodule update --init --recursive
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