You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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?