Challenge - 5 Problems
Git Stash Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of
git stash list after stashing changes?You have modified files in your git repository. You run
git stash to save your changes temporarily. What will git stash list show immediately after?Git
git stash git stash list
Attempts:
2 left
💡 Hint
Think about what
git stash does and how git stash list displays saved stashes.✗ Incorrect
After running git stash, your changes are saved as a stash entry. git stash list shows this entry with a name like stash@{0} and the commit it is based on.
🧠 Conceptual
intermediate1:30remaining
What happens to your working directory after running
git stash?You have uncommitted changes in your working directory. You run
git stash. What is the state of your working directory immediately after?Attempts:
2 left
💡 Hint
Consider what
stash means: saving changes temporarily and cleaning your workspace.✗ Incorrect
git stash saves all your uncommitted changes and resets your working directory to match the last commit, so it becomes clean.
🔀 Workflow
advanced2:00remaining
Which sequence of commands correctly saves changes and then applies them back?
You want to save your current changes temporarily and later bring them back. Which command sequence does this correctly?
Attempts:
2 left
💡 Hint
Remember the basic commands to save and reapply stashed changes.
✗ Incorrect
git stash saves changes, and git stash apply reapplies them without removing the stash entry.
❓ Troubleshoot
advanced1:30remaining
What error occurs if you run
git stash apply with no stashes saved?You run
git stash apply but you never saved any stash before. What error message will git show?Git
git stash applyAttempts:
2 left
💡 Hint
Think about what happens when git tries to apply a stash that does not exist.
✗ Incorrect
If no stash exists, git stash apply tries to apply stash@{0} but fails with fatal: bad revision 'stash@{0}'.
✅ Best Practice
expert2:00remaining
Which command safely saves changes including untracked files?
You want to stash your changes but also include new untracked files. Which command should you use?
Attempts:
2 left
💡 Hint
Look for the modern command to stash including untracked files.
✗ Incorrect
git stash push -u stashes both tracked and untracked files safely. The older git stash save is deprecated and does not support this flag.