0
0
Gitdevops~20 mins

Creating named stashes in Git - Practice Exercises

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 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?
Astash@{0}: WIP on main: work in progress
Bstash@{0}: On main: work in progress
Cstash@{0}: On main - work in progress
Dstash@{0}: WIP main work in progress
Attempts:
2 left
💡 Hint
The message format includes 'WIP on' followed by the branch name and the message.
💻 Command Output
intermediate
1:30remaining
What error occurs with invalid stash message syntax?
What error will occur if you run git stash push -m without providing a message?
Aerror: switch `m' requires a value
Bfatal: You must provide a message with -m
Cerror: missing message for stash
Dfatal: no stash message given
Attempts:
2 left
💡 Hint
Check the error message about missing value for the -m option.
🔀 Workflow
advanced
2: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?
Agit stash save "feature update" && git stash pop stash@{0}
Bgit stash push -m feature update && git stash pop stash@{0}
Cgit stash push -m "feature update" && git stash apply stash@{0}
Dgit stash push "feature update" && git stash apply stash@{1}
Attempts:
2 left
💡 Hint
Remember the correct syntax for naming a stash and applying it.
Troubleshoot
advanced
2: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?
AYou must use double dashes before -m like --m
BYour git version is older and does not support the -m option for stash push
CThe message must be provided without quotes
DYou need to run git stash save instead of push
Attempts:
2 left
💡 Hint
Check your git version and its support for stash push options.
Best Practice
expert
3: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?
A"temp"
B"WIP"
C"fix"
D"<branch-name>: <short description> - <date>"
Attempts:
2 left
💡 Hint
Think about clarity and useful information in the stash message.