Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - default push to --recurse-submodules=check

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?

like image 423
noah Avatar asked Oct 01 '12 22:10

noah


People also ask

Does git push push submodules?

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.

What is git recurse submodules?

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.

Will git pull update submodules?

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.


2 Answers

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.

like image 118
Mike Crowe Avatar answered Sep 30 '22 13:09

Mike Crowe


You could try aliasing it.

git config alias.ps "push --recurse-submodules=check"

Then use

git ps
like image 40
besen Avatar answered Sep 30 '22 13:09

besen