Challenge - 5 Problems
Git Stash Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of
git stash pop when there are no stashes?You run
git stash pop but your stash list is empty. What will Git output?Attempts:
2 left
💡 Hint
Think about what happens if you try to apply a stash that does not exist.
✗ Incorrect
If there are no stashes saved, git stash pop will output No stash entries found. because there is nothing to apply or drop.
💻 Command Output
intermediate2:00remaining
What happens when
git stash pop is run and conflicts occur?You have local changes conflicting with the stash content. You run
git stash pop. What output do you expect?Attempts:
2 left
💡 Hint
Conflicts during stash pop behave like merge conflicts.
✗ Incorrect
If conflicts happen, Git shows the conflicting files and reports failure to apply the stash. The stash is not dropped in this case.
🔀 Workflow
advanced2:00remaining
Which command sequence correctly restores and removes the latest stash?
You want to restore your latest stash and remove it from the stash list in one step. Which command sequence does this?
Attempts:
2 left
💡 Hint
One command both applies and removes the stash.
✗ Incorrect
git stash pop applies the latest stash and then removes it from the stash list automatically.
❓ Troubleshoot
advanced2:00remaining
Why does
git stash pop fail with 'Your local changes would be overwritten'?You run
git stash pop but get an error saying your local changes would be overwritten. What is the cause?Attempts:
2 left
💡 Hint
Think about what happens if the stash tries to overwrite files you changed.
✗ Incorrect
This error means Git refuses to apply the stash because it would overwrite your current uncommitted changes, preventing data loss.
✅ Best Practice
expert2:00remaining
What is the safest way to restore a stash without losing it if conflicts occur?
You want to restore your stash but keep it safe in case conflicts happen. Which command should you use?
Attempts:
2 left
💡 Hint
One command applies stash but does not remove it.
✗ Incorrect
git stash apply restores the stash but keeps it in the stash list, so you can retry or drop it later if conflicts occur.