Is there a way to automatically have git submodule update
(or preferably git submodule update --init
called whenever git pull
is done?
Looking for a git config setting, or a git alias to help with this.
Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
git submodule sync synchronizes all submodules while git submodule sync -- A synchronizes submodule "A" only. If --recursive is specified, this command will recurse into the registered submodules, and sync any nested submodules within.
As of Git 2.14, you can use git pull --recurse-submodules
(and alias it to whatever you like).
As of Git 2.15, you could set submodule.recurse
to true to enable the desired behaviour.
You can do this globally by running:
git config --global submodule.recurse true
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