Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

How do you update a submodule to its latest version?

SHORT ANSWER

Go into the submodule, pull the wanted commit, then commit the changed pointer in the parent. Or run git submodule update --remote to fetch the tracked branch's latest commit for you.

Explain it simply

The parent points at one specific edition. Moving to the new edition is a two-step process: change the child, then record that change in the parent.

git submodule update --remote libs/ui-kit fetches the child's configured branch and checks out its tip. Then git status in the parent shows modified: libs/ui-kit (new commits). Commit that to share the update. Teammates run git submodule update --init after pulling to move to the same version. Merely pulling the parent does not change submodule contents.

Example

bash
git submodule update --remote libs/ui-kit
git add libs/ui-kit
git commit -m "Bump ui-kit to latest"
git push

What to say in the interview

"I update the submodule with git submodule update --remote or by pulling inside it, then commit the new pointer in the parent. Teammates need git submodule update after pulling to match."

#git#submodules#update

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.