Reading the documentation of the git submodule command I found out that you can specify a branch for a submodule using
git submodule set-branch -branch <branch name> -- <submodule path>
This results in a config entry in the .gitmodules file
> git config --file .gitmodules --get-regex branch
...
submodule.<submodule name>.branch = <branch name>
However the documentation did not describe what this data is used for. Submodules are still checked out in the detached head state an I've failed to find a way to use this info to do a checkout for the submodule from the parent repository that sets up the submodule in a state that tracks a branch without doing a checkout inside the submodule directly.
What's the benefit of providing this info (other than the .gitmodules file containing info that could be retrieved and used by my own script)? (Or did I simply do the initialisation/update of the submodules the wrong way?)