What .gitmodules Actually Records
cat .gitmodules
git submodule status
.gitmodules records the real submodule's path and URL. git submodule status shows the exact real commit it is currently pinned to — a plain hash, since it is genuinely detached, not tracking a branch tip.
A Real Detached HEAD, Inside a Submodule
cd vendor/cooking-utils && git status
Exactly the same real detached-HEAD state Block 3.4 covered — just inside a nested, separate repository this time.
Catching It Up
cd vendor/cooking-utils
git fetch origin
git checkout origin/master
cd ..
git add vendor/cooking-utils
git commit -m "Update cooking-utils submodule to latest"
Updating a submodule is genuinely a two-repository act: move the submodule's own HEAD to the new commit, then commit that new pointer in the parent repository, exactly like updating any other tracked file.
vendor/cooking-utils is a genuine git submodule — a real, separate repository (Grace Hopper's shared cooking-utils library) embedded at a specific path, with team-recipes recording exactly which real commit of it to use. That real commit is currently an older one; a newer one already exists upstream, not yet pulled in.
Checking out any specific commit inside a submodule (rather than tracking a branch tip) is a genuine, real detached HEAD — the exact same state Block 3.4 already covered, just inside a nested repository instead of the main one. Updating it is a real, two-step act: fetch and check out the new commit inside the submodule itself, then commit the updated reference in the parent.
git submodule status
Shows the real, exact commit each submodule is currently pinned to. Confirmed directly in this lab: the hash shown matched the older of the two real commits published in the shared library.
Detached HEAD inside a submodule
A submodule's checkout is genuinely detached by default, pinned to one specific real commit rather than tracking a branch. Confirmed directly in this lab: git status inside vendor/cooking-utils showed the exact same real detached-HEAD state as Block 3.4, just in a nested repository.
Takeaways
- .gitmodules records a submodule's real path and URL; git submodule status shows the exact commit it is pinned to
- A submodule's checkout is genuinely a detached HEAD by default — pinned to one commit, not tracking a branch
- Updating a submodule is a real, two-repository act: move its own HEAD, then commit the new reference in the parent
- Pinning to a specific commit (rather than always tracking a branch tip) is deliberate — each consumer updates on its own schedule