When I run the command git submodule status
, I see references to tags from months or even years ago. Everything else works fine (the code checks out what I expect it to, and there is no other weird behaviour).
The issue is that this one command displaying it incorrectly. Everything works fine. git submodule update
always gets what I expect, and I frequently update the submodules with git add
and git push
.
username:~/src/main (master)$ git submodule status
3f786850e387550fdab836ed7e6dc881de23001b module0 (old-tag-1234-g8f123456)
89e6c98d92887913cadf06b2adb97f26cde4849b module1 (years-old-tag-4321-g12f4567890)
2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69 module2 (heads/master)
e983f374794de9c64e3d1c1de1d490c0756eeeff module3 (heads/master)
This is strange, because ALL of my submodules have the master
branch checked out. I would expect this command to show me heads/master
for all 4 of the modules.
username:~/src/main/module0 (master)$ git status
On branch master
Your branch is up to date with 'origin/master'.
...
username:~/src/main/module3 (master)$ git status
On branch master
Your branch is up to date with 'origin/master'.
These submodules are properly referenced too - a git submodule update
does not result in any changes to them. This is a repository updated dozens of times daily by dozens of people - There is zero chance that we're accidentally using code from 3 years ago, or forgot to update it.
To further emphasise: The issue is that this one command displaying it incorrectly. Everything works fine
Can anyone suggest reason's why? I suspect this might be something to do with needing to do a update-ref
for everything, or some kind of stale refs in ~/src/main/.git/modules/module0/info/refs
git submodule status
is doing is runninggit describe
in each submodule. That'sgit describe
, notgit describe --all
. So each submodule Git is not looking at any of the branch names, and won't "describe" the submodule asmaster
, because that's a branch name andgit describe
uses annotated tags. – Towlinegit submodule status
usegit describe --all
. You can however usegit submodule foreach
to rungit describe --all
in each submodule. (Based on theheads/master
for two of them,git submodule status
must be using--always
, which falls back on branch names when there are no tags. Would be nice if one could control this easier...) – Towline