git submodules - Git: Find out which branch contains a commit and check it out? -
from i've learned here submodules, can roll submodules right commit using
git submodule update --recursive
however, submodules never (rarely?) in branch. think branch submodule needs not stored. anyway, can use
git branch --contains head
in submodule , figure out branch , switch it. there built-in way this? goal branch contains commit (if there one).
by default, git doesn't track submodules branches, tracks them commits. git submodule update
result in submodules being in detached head state (similar if git checkout
specific commit hash). before doing work, you'll have make sure check out branch, otherwise things messy.
as of git 1.8.2, can have submodules track branches. option needs specified when add submodule:
git submodule add -b master <git repo url>
if track submodules via branches, you'll want add --remote
update call:
git submodule update --remote
you can read more tracking submodules via branches here , here.
Comments
Post a Comment