Gitflow
🪛Submodule Points to Wrong CommitMedium+550 XP
Workshop
Scenario reference

Submodule Points to Wrong Commit: the situation, step by step

The situation

Your submodule `vendor/shared-ui` is 8 commits behind upstream. CI is failing because a fix you need lives in newer commits.

Update the submodule pointer, then commit the new SHA in the parent repo.

Medium · 3 steps · +550 XP

What you will practice

This scenario walks through 3 steps, in order:

  1. 01Sync and pull the latest in the submodule
  2. 02Stage the pointer bump
  3. 03Commit the new pointer
Reveal the step-by-step commands

Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.

  1. 1. Sync and pull the latest in the submodule
    git submodule update --remote vendor/shared-ui
  2. 2. Stage the pointer bump
    git add vendor/shared-ui
  3. 3. Commit the new pointer
    git commit -m "chore: bump shared-ui"

Key takeaway

Submodule updates are two-step: bump the sub-repo, then commit the pointer.