I am setting up a git-repository that will be used by 5-10 developers I have setup a few submodules within my main repository, but it seems they do not automatically track a branch upon recursive clone. The main problem is to avoid developers committing outside a branch (i.e. headless)
I believe i have added the submodules the way other StackOverflow post suggest you should setup branch tracking. e.g. git submodule tracking latest
i use git 2.7.4 and add with the commands
git submodule add -b ${submodule_branch} ../../${submodule_repo_path}.git ${submodule_path}
git submodule update --remote
When i call 'git branch' within one of the submodules it clearly show that i am on a branch.
git branch
* master
I commit this change and push to the remote 'git push origin --mirror --force'
The server is BitBucket v5.3.0
When i clone with 'git clone --recursive' i get all the repo and the .gitmodules looks right, it mentions the branch
[submodule "some_app"]
path = some_app
url = ../../some_app.git
branch = master
However within the submodule it looks like it is detached:
somepath/some_app ((487b858...))
$ git branch
git branch
* (HEAD detached at 487b858)
master
I can make a workaround by checking out the correct branch in each submodule, but i do not think it should be needed.
i have also tried to call
git submodule update --remote
after cloning, but it did not help
Is it normal practice that you must first checkout a branch when working with submodules?