git - Putting a submodule on the master branch if the checked out HEAD is the tip of master -
is possible checkout master branch in each submodule if , if tip of master checked out commit?
it great if in hook don't have manually.
the reason need can push changed submodules content origin , other remotes afterwards.
generally speaking can use git-submodule foreach
stuff iteratively each submodule. run foreach, , compare head master
$(git rev-parse --abbrev-ref head) == $(git rev-parse --abbrev-ref master)
however, may interested know can tell submodules not detach heads when updating defining update property in .gitmodules
. find submodule relevant submodule in .gitmodules
, add update = rebase
or update = merge
under it. mean when when submodule update, git go submodule , instead of checking out commit directly (which detaches head), perform either pull or rebase.
documentation bit shotty, take @ submodule.$name.update option, --merge , --rebase update flags, , --branch flag.
https://www.kernel.org/pub/software/scm/git/docs/git-submodule.html
Comments
Post a Comment