Interview Prep/Git & GitHub/Scale, Submodules, LFS and GitHub Automation

A repository uses a submodule. How does a developer get the right version of it?

BeginnerScenarioScale, Submodules, LFS and GitHub Automation
Answer

Situation read → The parent repo pins the submodule to an exact commit.

What I'd do →

  1. Fresh clone: git clone --recurse-submodules URL.
  2. Existing clone: git submodule update --init --recursive.
  3. After pulling the parent, run git submodule update to match the pinned commit.
  4. Set git config submodule.recurse true to automate it.

Why → The submodule shows as a pointer; nothing updates it unless you run the command.

Interview tip → A "modified: libs/shared (new commits)" status means your checkout differs from the pin.

All Git & GitHub questions Roadmap: Git & GitHub

More on Scale, Submodules, LFS and GitHub Automation