We're starting to use git submodules and I'm trying to provide some chrome for my developers.
I know git stores the SHA of the submodule so it takes a commit, so that means if a developer wants to update a submodule dependency, they do it by CDing in and getting latest, then committing the change in the outer dir.
But the problem is that by default git submodules have detached heads. Is there way to configure a git submodule within the repo to always track a certain remote branch? And commands to change this remote tracking branch?
I'd like to be able to write a quick "update my submodule and commit" script, or a quick "switch my submodule's branch from the dev to a release branch". The fact that we're switching branches means I can't just hardcode the branch name everywhere. Does git store this in a decent location, or am I going to have to roll my own .submoduleconfig thingy for my scripts to read?
I have searched for this before and most of the similar questions are how to make it auto-track latest (which git does not support) and alternately how to manually push the submodule to the latest of a specific branch you give it, not just "you're already tracking this branch, get latest".