It automatically pulls in the submodule data assuming you have already added the submodules to the parent project. Note that --recurse-submodules and --recursive are equivalent aliases.
git submodule foreach git pull origin master or git pull origin master --recurse-submodules is what you want if you intend to update each submodule to the latest from their origin repositories. Only then will you get pending changes in the parent repo with updated revision hashes for submodules.
From the root of the repo just run:
git submodule update --init
If you need to pull stuff for submodules into your submodule repositories use
git pull --recurse-submodules
But this will not checkout proper commits(the ones your master repository points to) in submodules
To checkout proper commits in your submodules you should update them after pulling using
git submodule update --recursive
If there are nested submodules, you will need to use:
git submodule update --init --recursive
I just want to share these.
First way,git submodule init && git submodule update
The below is just basically combining the first way,git submodule update --init
If there are any nested submodules, Iglesk's answer is the way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With