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.
The following page has info on how/where to report bugs with Git:
However, I would suggest first checking what version of Git you have installed locally and upgrading to the latest version.
I have tried the steps you mentioned in your question on my machine (with the latest version of Git installed) and git submodule status <path to submodule> returns the HEAD of the branch I determined.
You can check the version of Git on your machine with the command git --version
The latest version available is listed here: https://git-scm.com/downloads
If you have an older version locally, can you try upgrading to the latest one and see if the issue persists?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.