Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does the command git stash drop do?
It removes a specific stash entry from the stash list, freeing up space and cleaning up unused stashes.
Click to reveal answer
beginner
How do you remove all stash entries at once?
Use git stash clear to delete all stashes in one command.
Click to reveal answer
intermediate
What is the difference between git stash drop and git stash pop?
git stash drop deletes a stash without applying it, while git stash pop applies the stash changes and then deletes it.
Click to reveal answer
intermediate
How can you specify which stash to drop?
You specify the stash by its name or index, for example: git stash drop stash@{2} drops the third stash.
Click to reveal answer
beginner
Why is it important to clear or drop stashes regularly?
Because stashes take up space and can clutter your repository, clearing unused stashes keeps your workspace clean and organized.
Click to reveal answer
Which command removes all stash entries at once?
Agit stash apply
Bgit stash drop
Cgit stash pop
Dgit stash clear
✗ Incorrect
git stash clear deletes all stash entries, while git stash drop removes one specific stash.
What happens when you run git stash drop stash@{0}?
AIt deletes the most recent stash without applying it
BIt applies the stash and deletes it
CIt clears all stashes
DIt lists all stashes
✗ Incorrect
git stash drop stash@{0} deletes the most recent stash without applying its changes.
Which command applies a stash and then removes it from the stash list?
Agit stash drop
Bgit stash pop
Cgit stash clear
Dgit stash list
✗ Incorrect
git stash pop applies the stash changes and then deletes the stash entry.
If you want to remove a stash but keep its changes for later, which command should you NOT use?
Agit stash apply
Bgit stash pop
Cgit stash drop
Dgit stash list
✗ Incorrect
git stash drop deletes the stash without applying changes, so you lose the saved work.
What is the default stash that git stash drop removes if no stash is specified?
Astash@{0} (most recent stash)
Bstash@{1} (second most recent stash)
CAll stashes
DNo stash is removed by default
✗ Incorrect
By default, git stash drop removes the most recent stash, which is stash@{0}.
Explain how to safely remove a specific stash entry and why you might want to do this.
Think about how to target one stash and the benefit of cleaning up.
You got /4 concepts.
Describe the difference between clearing all stashes and dropping a single stash.
Consider when you want to remove everything vs just one stash.
You got /4 concepts.
Practice
(1/5)
1. What does the git stash drop command do?
easy
A. Removes a single stash entry from the stash list
B. Removes all stash entries at once
C. Creates a new stash entry
D. Shows the list of all stash entries
Solution
Step 1: Understand the purpose of git stash drop
This command is used to remove one specific stash entry from the stash list.
Step 2: Differentiate from clearing all stashes
git stash clear removes all stashes, not just one.
Final Answer:
Removes a single stash entry from the stash list -> Option A
Quick Check:
Drop = remove one stash [OK]
Hint: Drop removes one stash, clear removes all [OK]
Common Mistakes:
Confusing drop with clear
Thinking drop creates a stash
Assuming drop shows stash list
2. Which of the following is the correct syntax to clear all stashes in git?
easy
A. git stash drop --all
B. git stash delete --all
C. git stash clear
D. git stash remove all
Solution
Step 1: Identify the command to clear all stashes
The correct command to remove all stash entries is git stash clear.
Step 2: Check other options for correctness
Options A, B, and C are not valid git commands for clearing stashes.
Final Answer:
git stash clear -> Option C
Quick Check:
Clear = remove all stashes [OK]
Hint: Use 'git stash clear' to delete all stashes at once [OK]
Common Mistakes:
Using 'drop --all' which is invalid
Trying 'remove all' which is not a git command
Confusing delete with clear
3. Given the stash list: stash@{0}: WIP on feature stash@{1}: Fix bug stash@{2}: Update docs What will be the stash list after running git stash drop stash@{1}?
medium
A. stash@{0}: WIP on feature stash@{1}: Fix bug
B. stash@{0}: WIP on feature stash@{1}: Fix bug stash@{2}: Update docs
C. stash@{0}: Fix bug stash@{1}: Update docs
D. stash@{0}: WIP on feature stash@{1}: Update docs
Solution
Step 1: Understand what git stash drop stash@{1} does
This command removes the stash at index 1, which is 'Fix bug'.
Step 2: Recognize stash reindexing after drop
After dropping stash@{1}, stash@{2} moves up to stash@{1} position.
Final Answer:
stash@{0}: WIP on feature stash@{1}: Update docs -> Option D
Quick Check:
Drop stash@{1} removes it and shifts others up [OK]
Hint: Dropped stash removed, higher indexes shift down [OK]
Common Mistakes:
Not realizing stash indexes shift after drop
Assuming stash@{1} remains after drop
Confusing stash names with indexes
4. You tried to remove all stashes using git stash drop without any arguments, but it did not remove all stashes. What is the likely cause?
medium
A. The command git stash drop clears all stashes by default
B. git stash drop without argument removes only the most recent stash (stash@{0}), not all
C. You need to run git stash clear before drop works
D. You must be on the master branch to drop stashes
Solution
Step 1: Understand git stash drop usage
This command removes one stash: stash@{0} (most recent) if no argument given, or a specific stash if referenced.
Step 2: Identify why it doesn't remove all
Without argument, it only drops the most recent stash, not all. To remove all, repeat or use git stash clear.
Final Answer:
git stash drop without argument removes only the most recent stash (stash@{0}), not all -> Option B
Quick Check:
Drop w/o arg = drop stash@{0} only [OK]
Hint: drop w/o arg removes latest only, clear removes all [OK]
Common Mistakes:
Assuming drop clears all stashes
Thinking drop without argument does nothing
Thinking branch affects stash drop
5. You have multiple stashes and want to remove all except the most recent one. Which sequence of commands achieves this safely?
hard
A. Run git stash drop stash@{1} repeatedly for all except stash@{0}
B. Run git stash clear then create a new stash for the most recent changes
C. Run git stash pop to apply and remove all stashes except the latest
D. Run git stash drop stash@{0} to remove the latest stash only
Solution
Step 1: Understand stash indexing and removal
Stashes are indexed from 0 (most recent) upwards. To keep the latest, remove others starting from index 1.
Step 2: Use git stash drop stash@{1} repeatedly
Dropping stash@{1} repeatedly removes older stashes safely without affecting the latest stash@{0}.
Final Answer:
Run git stash drop stash@{1} repeatedly for all except stash@{0} -> Option A
Quick Check:
Drop specific stashes to keep latest safe [OK]
Hint: Drop stashes from index 1 up to keep latest [OK]
Common Mistakes:
Using clear which deletes all stashes
Using pop which applies and removes only one stash