Challenge - 5 Problems
Submodule Removal Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output after removing a submodule directory?
You run these commands in a git repository:
What will
git rm --cached path/to/submodulerm -rf path/to/submodulegit commit -m "Remove submodule"What will
git status show immediately after the commit?Attempts:
2 left
💡 Hint
Think about what happens when you remove a submodule properly and commit.
✗ Incorrect
After removing the submodule with git rm --cached and deleting its directory, committing removes it from the index and working tree. So git status shows a clean state with no changes.
❓ Configuration
intermediate1:30remaining
Which file must be edited to fully remove a submodule?
You want to completely remove a submodule from your git project. Besides removing the submodule directory and running
git rm --cached, which file must you edit to remove the submodule reference?Attempts:
2 left
💡 Hint
This file tracks submodule paths and URLs.
✗ Incorrect
The .gitmodules file contains the configuration for submodules. Removing the submodule requires deleting its entry from this file.
❓ Troubleshoot
advanced2:30remaining
Why does git still show a submodule after removal?
You removed a submodule directory and ran
git rm --cached and committed. But git status still shows the submodule as modified. What is the most likely cause?Attempts:
2 left
💡 Hint
Check all places where submodule info is stored.
✗ Incorrect
Even after removing the submodule directory and index entry, if .gitmodules or .git/config still reference the submodule, git will show it as modified.
🔀 Workflow
advanced3:00remaining
Correct sequence to fully remove a git submodule
Arrange the steps in the correct order to fully remove a git submodule named
libs/foo:Attempts:
2 left
💡 Hint
Think about removing from index before deleting files and updating config.
✗ Incorrect
First remove from index with git rm --cached, then remove from .gitmodules, delete directory, then commit.
✅ Best Practice
expert3:00remaining
What is the safest way to remove a submodule to avoid repository corruption?
Which practice helps avoid repository corruption when removing a git submodule?
Attempts:
2 left
💡 Hint
Follow git's recommended removal steps carefully.
✗ Incorrect
The safest way is to remove the submodule from the index first, then remove config entries, delete directory, and commit. This prevents leftover references causing corruption.