Example of a product repository which uses git submodule
module
folder pointed to a specific git hash of another git repomodule-dev
folder pointed todev
branch of another git repo
git submodule add [email protected]:berezhinskiy/git-submodule-module.git module
cd module
git checkout <commitid>
git commit -m 'Update module to <commitid>' module
git submodule add -b dev [email protected]:berezhinskiy/git-submodule-module.git module-dev
After cloning the repo, submodules will be switched into a detached HEAD state. If you make changes in the submodule branch and commit, Git will create the commit and leave submodules with a detached HEAD.
> git status
HEAD detached at f74a7bb
nothing to commit, working tree clean
submodule.<name>.update
and submodule.<name>.branch
parameters in .gitmodules
config can solve this potential problem.
More info is here