I set the branch that I want my submodule to point to using this command:
git submodule set-branch -b <branch-name> <path to submodule>
That works. I can see the branch = <branch name> in .gitmodules.
Then I update the submodule to the head of the branch like this:
git submodule update --remote <path to submodule>
That does update to the commit that matches the head of the branch.
However, when I ask:
git submodule status <path to submodule>
It reports that the submodule is on the main track, not on my branch.
I just want it to read the <branch name> from .gitmodules.
I think this is a bug in git because all the git documentation shows that it the branch should be displayed by git submodule status.