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 creating a named stash?
You run the command
git stash push -m "work in progress" in a repository with unstaged changes. What will git stash list show as the top entry?Attempts:
2 left
💡 Hint
The message format includes 'WIP on' followed by the branch name and the message.
✗ Incorrect
The git stash push -m "message" command creates a stash with a message. The stash list shows entries starting with 'WIP on' plus the branch name and the message.
💻 Command Output
intermediate1:30remaining
What error occurs with invalid stash message syntax?
What error will occur if you run
git stash push -m without providing a message?Attempts:
2 left
💡 Hint
Check the error message about missing value for the -m option.
✗ Incorrect
The -m option requires a message string. Running without a message causes git to report 'error: switch `m' requires a value'.
🔀 Workflow
advanced2:30remaining
Which command sequence correctly creates and applies a named stash?
You want to save your current changes with a name and then apply them back later. Which sequence of commands does this correctly?
Attempts:
2 left
💡 Hint
Remember the correct syntax for naming a stash and applying it.
✗ Incorrect
git stash push -m "message" creates a named stash. Then git stash apply stash@{0} applies the latest stash without removing it.
❓ Troubleshoot
advanced2:00remaining
Why does
git stash push -m fail with 'unknown option' error?You run
git stash push -m "fix bug" but get an error: error: unknown option '-m'. What is the likely cause?Attempts:
2 left
💡 Hint
Check your git version and its support for stash push options.
✗ Incorrect
The -m option for git stash push was added in git 2.13. Older versions do not recognize it and show 'unknown option'.
✅ Best Practice
expert3:00remaining
What is the best practice for naming stashes to avoid confusion in a team?
Which naming style for stash messages helps a team clearly understand the purpose of each stash?
Attempts:
2 left
💡 Hint
Think about clarity and useful information in the stash message.
✗ Incorrect
Including the branch name, a short description, and the date in stash messages helps everyone understand what the stash is about and when it was created.