I have a git submodule configured to track a specific branch:
[submodule "subproject"]
path = subproject
url = ../subproject.git
branch = v2.44
In my build script, I want to be able to query the branch of the subproject, so I use cd subproject && git rev-parse --abbrev-ref HEAD
. I would expect this to output v2.44
, but it always outputs HEAD
.
When I go into subproject/
and inspect the branch, I get:
git branch -v
* (HEAD detached at b69ac07) b69ac07 Another commit
master 36096e7 Some commit
What's going on here? Why would I be detached rather than on the v2.44
branch?
If I manually git checkout v2.44
, the parent git repo doesn't detect any sort of modification to the submodule either, versus if I were to git checkout v2.43
and then it does notice that the submodule was modified.