0
0
Gitdevops~5 mins

Submodule status and sync in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Agit submodule init
Bgit submodule sync
Cgit submodule update
Dgit submodule status
What does git submodule update --init --recursive do?
AInitializes and updates all submodules and nested submodules
BOnly initializes submodules without updating
CSyncs submodule URLs with the main repository
DRemoves all submodules
When should you run git submodule sync?
AAfter changing submodule URLs in the main repository
BBefore cloning a repository
CTo commit changes in submodules
DTo delete submodules
What happens if you don't run git submodule sync after changing a submodule URL?
ASubmodules get deleted automatically
BYour local submodule URL remains outdated
CSubmodules update to the new URL anyway
DGit throws an error on every command
Which option ensures commands apply to nested submodules as well?
A--all
B--force
C--recursive
D--init
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.