I always forget to push submodules. Sometimes I forget to add --recurse-submodules=check
to git push
. Even worse, others on my team might do the same. Is there a git config
option we can set to make check
the default?
In the parent repo, you can also use git push --recurse-submodules=check which prevents pushing the parent repo if the submodule(s) are not pushed first. Another option is git push --recurse-submodules=on-demand which will try to push the submodules automatically (if necessary) before pushing the parent repo.
Cloning a Project with Submodules If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
If you track branches in your submodules, you can update them via the --remote parameter of the git submodule update command. This pulls in new commits into the main repository and its submodules. It also changes the working directories of the submodules to the commit of the tracked branch.
Git v2.7.0 adds support for the push.recurseSubmodules
configuration option. It can be set to the same values as the --recurse-submodules
command line options. For example:
git config push.recurseSubmodules check
means that subsequent invocations of git push
will automatically check that submodules have been pushed.
You could try aliasing it.
git config alias.ps "push --recurse-submodules=check"
Then use
git ps
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