0
0
Gitdevops~20 mins

git stash pop to restore - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Stash Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2: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?
AAlready up to date.
Berror: Your local changes to the following files would be overwritten by merge:
CDropped refs/stash@{0} (a1b2c3d4)
DNo stash entries found.
Attempts:
2 left
💡 Hint
Think about what happens if you try to apply a stash that does not exist.
💻 Command Output
intermediate
2: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?
A
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Failed to apply stash@{0}
BDropped refs/stash@{0} (a1b2c3d4)
CNo stash entries found.
DAlready up to date.
Attempts:
2 left
💡 Hint
Conflicts during stash pop behave like merge conflicts.
🔀 Workflow
advanced
2: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?
Agit stash apply && git stash drop
Bgit stash pop
Cgit stash apply
Dgit stash drop
Attempts:
2 left
💡 Hint

One command both applies and removes the stash.

Troubleshoot
advanced
2: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?
AYou have uncommitted changes conflicting with the stash content.
BThe stash list is empty.
CYou are not on any branch.
DThe stash was already dropped.
Attempts:
2 left
💡 Hint
Think about what happens if the stash tries to overwrite files you changed.
Best Practice
expert
2: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?
Agit stash drop
Bgit stash pop
Cgit stash apply
Dgit stash save
Attempts:
2 left
💡 Hint
One command applies stash but does not remove it.