is there some hook script in git that will detect if the submodule source tree is available whenever you push to the main project? Intend to avoid people pushing a master project that has unpushed submodules
You can use (git 1.7.7+):
git push --recurse-submodules=on-demand
I present it in "Git submodule push", and it detects any submodule modification, to push it first, before pushing the main repo.
Note that there are 2 options:
git push --recurse-submodules=check
git push --recurse-submodules=on-demand
Make sure all submodule commits used by the revisions to be pushed are available on a remote tracking branch.
If
check
is used git will verify that all submodule commits that changed in the revisions to be pushed are available on at least one remote of the submodule.
If any commits are missing the push will be aborted and exit with non-zero status.If
on-demand
is used all submodules that changed in the revisions to be pushed will be pushed.
If on-demand was not able to push all necessary revisions it will also be aborted and exit with non-zero status.
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