Git - submodules HEAD is always detached after running update? -
i have configuration submodule in .gitmodules file: [submodule "sub"] shallow = true branch = master path = sub url = https://path/to/repo.git now want when clones repo , runs these commands: git submodule init git submodule update is shallow master branch of submodule. happens not checkout master branch. detached head, need manually run git checkout master . instead of 2 commands, user needs run 1 additional. i looked this: why git submodule head detached master? but advice on accepted answers, not seem help: added branch want in .gitmodules file, added remote upstream master (this works cloned/updated repository after had checkout master myself). so intended detached head if clones repository , wants set submodule? i'm still investigating this, here script came , using now: #! /bin/bash