Git Submodules: detached HEAD from lost commit pin

Опубликовано: 29 Август 2026
на канале: TheCodeForge
9
1

A submodule update left a detached HEAD — the parent pinned a lost commit. Root cause: Submodules check out a commit, not a branch, by default. The fix: `git submodule update --remote` on a tracked branch; commit the pin.

A production war story from the TheCodeForge Git series — the incident, why it happened, and the exact fix.

⏳ Timestamps:
0:00 - Cold open: error: pathspec 'submodule/foo' did not match any file(s) known to git
0:11 - Intro
0:19 - What Is a Submodule?
0:38 - How Submodules Work
1:11 - Adding a Submodule
1:38 - Cloning with Submodules
2:05 - Updating Submodules
2:38 - Merge Conflicts with Submodules
3:14 - Submodules in CI/CD
3:47 - When Not to Use Submodules
4:05 - error: pathspec 'submodule/foo' did not match any file(s) known to git
4:28 - Submodule commit not pushed
4:42 - The Fix
5:00 - ⚠ Gotcha: Pushing parent before submodule commit
5:16 - ⚠ Gotcha: Making changes in submodule without checking out a branch
5:32 - ⚠ Gotcha: Pinning submodule to a branch instead of a tag
5:50 - Automated Submodule Push Check
6:06 - Submodule Branch Tracking Caveat
6:41 - Debugging Guide
6:56 - Interview Questions
7:24 - FAQ
7:48 - Key Takeaways
8:06 - Next up
8:21 - Wrap-up

👉 Full article + code: https://thecodeforge.io/devops/git-su...
⏭ Next up: Git Internals: Objects, Trees, Blobs and the DAG

#git #devops #versioncontrol