0
0
Gitdevops~20 mins

Submodule status and sync in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Submodule Sync Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Check submodule status output
You run the command git submodule status in a repository with one submodule. What does the output show if the submodule is checked out at the commit recorded in the main repo?
Git
git submodule status
Aa1b2c3d4e5f6g7h8i9j0klmnopqrstuv submodule_path (heads/main)
B+a1b2c3d4e5f6g7h8i9j0klmnopqrstuv submodule_path
C a1b2c3d4e5f6g7h8i9j0klmnopqrstuv submodule_path
D-a1b2c3d4e5f6g7h8i9j0klmnopqrstuv submodule_path
Attempts:
2 left
💡 Hint
Look for the symbol at the start of the line indicating submodule sync state.
💻 Command Output
intermediate
2:00remaining
Effect of git submodule sync
What is the effect of running git submodule sync in a repository with submodules?
Git
git submodule sync
ARemoves all submodules from the repository
BFetches the latest commits for all submodules
CInitializes and clones missing submodules
DUpdates the URLs of submodules in .git/config to match .gitmodules
Attempts:
2 left
💡 Hint
Think about syncing configuration rather than fetching code.
🔀 Workflow
advanced
3:00remaining
Correct sequence to update submodules after URL change
You changed the URL of a submodule in .gitmodules. What is the correct sequence of commands to update your local config and fetch the submodule code?
A1,2,4,3
B3,1,2,4
C1,3,2,4
D2,1,3,4
Attempts:
2 left
💡 Hint
Sync URLs first, then update submodules, then check status.
Troubleshoot
advanced
2:00remaining
Error when submodule commit is missing locally
You run git submodule update but get an error that the commit is not found. What is the most likely cause?
AThe submodule is already up to date
BThe submodule repository URL is incorrect or unreachable
CThe main repository has no submodules configured
DThe main repository's HEAD is detached
Attempts:
2 left
💡 Hint
Think about why the commit might not be available locally.
Best Practice
expert
3:00remaining
Best practice to keep submodules in sync across team
Which practice best ensures all team members have the correct submodule commits and URLs after a change?
AUpdate .gitmodules, commit, push, then instruct team to run <code>git submodule sync</code> and <code>git submodule update --init --recursive</code>
BCommit changes to .gitmodules and run <code>git submodule sync</code> locally only
CIgnore .gitmodules and manually clone submodules
DDelete and re-add submodules on each machine
Attempts:
2 left
💡 Hint
Think about sharing configuration and commands for team consistency.