Example of a product repository which uses git submodule
modulefolder pointed to a specific git hash of another git repomodule-devfolder pointed todevbranch 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>' modulegit submodule add -b dev [email protected]:berezhinskiy/git-submodule-module.git module-devAfter 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