Challenge - 5 Problems
Submodule Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Cloning a repository with submodules
What is the output of the following command when cloning a repository that contains submodules?
Git
git clone https://github.com/example/project-with-submodules.git
Attempts:
2 left
💡 Hint
Think about what git clone does by default regarding submodules.
✗ Incorrect
By default, 'git clone' clones only the main repository. Submodules are not cloned or initialized automatically unless additional commands or flags are used.
💻 Command Output
intermediate2:00remaining
Cloning with submodules initialized
What is the effect of running this command?
Git
git clone --recurse-submodules https://github.com/example/project-with-submodules.git
Attempts:
2 left
💡 Hint
Look for the flag that affects submodules during cloning.
✗ Incorrect
The '--recurse-submodules' flag tells git to clone the main repository and also initialize and update all submodules recursively.
❓ Troubleshoot
advanced2:00remaining
Submodule directory is empty after cloning
After cloning a repository without the '--recurse-submodules' flag, you notice the submodule directories are empty. Which command fixes this?
Attempts:
2 left
💡 Hint
You need to initialize and update submodules after cloning.
✗ Incorrect
The command 'git submodule update --init --recursive' initializes and updates all submodules after cloning.
🧠 Conceptual
advanced2:00remaining
Understanding submodule commit references
What does a git submodule record inside the main repository?
Attempts:
2 left
💡 Hint
Think about how git ensures the submodule is at a specific state.
✗ Incorrect
Git records the exact commit SHA of the submodule in the main repository to ensure consistent versions.
✅ Best Practice
expert2:00remaining
Best practice for updating submodules after main repo update
After pulling changes in the main repository that update submodule references, what is the best command to update your submodules accordingly?
Attempts:
2 left
💡 Hint
You want to update submodules to the commits recorded in the main repo.
✗ Incorrect
After pulling changes, 'git submodule update --init --recursive' updates submodules to the commits recorded in the main repo.