I’m writing this up mostly for my own benefit so that I don’t have to go searching for it again in future.
When you have a git repository which has a few submodules (.e.g. a vim dotfiles repo), you may find that you’ll notice one day that they all point to ancient commits in their parent repositories. Consequently, you want to update them, to get the new shiny things.
To do so is fairly straightforward (from your parent repository):
git submodule update --recursive --remote
This tells git that you want to update the submodules to the latest commit on the submodules remote tracking branch (
--remote) and to do it recursively (
--recursive) on all of the submodules (and their submodules if any).
Then if you check the
git status you should see something like this:
M:\vimfiles [master +0 ~9 -0]> git status # On branch master # Changes not staged for commit: # (use "git add
M:\vimfiles [master +0 ~9 -0]> git diff bundle/ctrlp diff --git a/bundle/ctrlp b/bundle/ctrlp index be5842a..b5d3fe6 160000 --- a/bundle/ctrlp +++ b/bundle/ctrlp @@ -1 +1 @@ -Subproject commit be5842a376f16c16c5dc4cc1879d7168a074f7de +Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030fHope that helps someone.
git submodule update git commit -am "Updated submodules to latest"