0Pricing
Git Advanced: Monorepo, Submodules & Workflows · Lesson

Pinning Submodules to Specific Tags and Commits

Master controlling exactly which commit or tag a submodule points to, ensuring reproducible builds and deliberate, reviewable dependency updates in advanced workflows.

Submodules Pin Commits, Not Branches

A common misconception: a submodule tracks a branch. In reality, the superproject records a specific commit SHA for each submodule. Branches only matter when you choose to update.

This pinning is what makes submodule-based builds reproducible across machines and time.

Inspecting the Pinned Commit

See exactly which commit each submodule is locked to with git submodule status. The leading SHA is the recorded pin.

git submodule status
# +a1b2c3d libs/engine (v2.3.0-4-ga1b2c3d)

All lessons in this course

  1. Working with Submodule Branches
  2. Nested Submodules and Complex Setups
  3. Common Submodule Issues & Fixes
  4. Pinning Submodules to Specific Tags and Commits
← Back to Git Advanced: Monorepo, Submodules & Workflows