Recall & Review
beginner
What does the command
git submodule status show?It shows the current commit checked out in each submodule and whether it is up to date with the main repository.
Click to reveal answer
beginner
How do you update all submodules to match the commits recorded in the main repository?
Use
git submodule update --init --recursive to initialize and update all submodules recursively.Click to reveal answer
intermediate
What is the purpose of
git submodule sync?It updates the URLs of submodules in the local configuration to match the main repository's configuration.
Click to reveal answer
intermediate
Why might you need to run
git submodule sync after changing the submodule URL?Because the local .git/config may still have the old URL, so syncing updates it to the new URL from the main repository.
Click to reveal answer
intermediate
What does the
--recursive option do when used with submodule commands?It applies the command to all nested submodules inside submodules, ensuring full update or sync.
Click to reveal answer
Which command shows the current commit checked out in each submodule?
✗ Incorrect
The command
git submodule status displays the commit each submodule is currently on.What does
git submodule update --init --recursive do?✗ Incorrect
This command initializes and updates all submodules, including nested ones.
When should you run
git submodule sync?✗ Incorrect
Sync updates local submodule URLs to match changes made in the main repository.
What happens if you don't run
git submodule sync after changing a submodule URL?✗ Incorrect
Without syncing, the local config keeps the old URL, causing potential fetch errors.
Which option ensures commands apply to nested submodules as well?
✗ Incorrect
The
--recursive option makes commands affect all nested submodules.Explain how to check the status of submodules and update them to the correct commit.
Think about commands that show current state and commands that bring submodules up to date.
You got /4 concepts.
Describe why and how you would use
git submodule sync in your workflow.Consider what happens when submodule URLs change in the main repo.
You got /4 concepts.