Dropping & Clearing Stashes
Stashes accumulate. Old ones become noise, and a noisy stash stack is one where you can't remember which entry is which. This page covers the two ways to remove stashes — surgically with git stash drop, or all at once with git stash clear — plus the reflog tricks that can sometimes save you when you delete the wrong one.
Drop a single stash
Default drops stash@{0}
git stash drop
# Dropped refs/stash@{0} (a1b2c3d4e5f6...)
# Drop a specific one
git stash drop stash@{2}
# Dropped stash@{2} (1a2b3c4d5e6f...)The output gives you the raw SHA of the dropped stash. Copy it — that's the only easy way to recover later if you regret it.
Indexes shift after a drop
Before and after dropping stash@{1}
Before: After:
stash@{0}: WIP feature/login stash@{0}: WIP feature/login
stash@{1}: WIP main hotfix stash@{1}: WIP feature/cart
stash@{2}: WIP feature/cartClear ALL stashes
The nuclear option
git stash clear # (no output on success — every stash is gone)
Recovery via reflog
Find a recently-dropped stash
# Stash deletions leave a trail in the stash reflog git fsck --unreachable | grep commit # unreachable commit a1b2c3d4e5f6... # unreachable commit 9f8e7d6c5b4a... # Inspect a candidate git show a1b2c3d4e5f6 # If that's your stash, bring it back git stash apply a1b2c3d4e5f6 # Or re-attach to the stash stack: git update-ref --create-reflog refs/stash a1b2c3d4e5f6
Recovery works because Git doesn't immediately delete the underlying commit objects when you drop a stash — it just removes the reference. The objects survive until garbage collection runs. That's your safety net, but it's not eternal.
Why you'd intentionally clear
End-of-week tidy-up. You popped everything you needed; the rest is debris.
Switching focus to a new project. Old stashes have zero relevance to the new work.
Before a
git gc --aggressive. Reduces the surface area Git has to traverse.Confused stack state. Sometimes it's faster to clear than to disentangle.
Best practices
Drop after popping a conflict.
popkeeps the stash if there's a conflict. Once you've resolved, rungit stash drop.Promote, don't hoard. If a stash has lived more than a couple of days, use
git stash branch <name>to turn it into a real branch.Use
apply+dropinstead ofpopwhen nervous. Apply, verify everything is right, then drop.Audit weekly.
git stash list --date=relativeonce a week makes you the kind of engineer who never loses work.
A typical cleanup session
Friday tidy-up
git stash list --date=relative --pretty=format:"%gd %cr %s"
# stash@{0} 2 hours ago WIP login validation
# stash@{1} 3 days ago WIP cart refactor
# stash@{2} 2 weeks ago debug spam from old bug
# Keep stash@{0}, promote stash@{1}, drop stash@{2}
git stash branch save/cart-refactor stash@{1}
# now stash@{1} is gone (branch creation drops it on success)
# the old stash@{2} just shifted to stash@{1}
git stash drop stash@{1}
git stash list
# stash@{0}: WIP login validationWhat "Dropped" really means
Real-world recipe: never lose work, even on clear
Backup before clearing
# Dump every stash to a branch first
i=0
while git rev-parse --verify "stash@{$i}" >/dev/null 2>&1; do
git stash branch "backup/stash-$i" "stash@{$i}" || break
i=$((i+1))
done
# Now safe to:
git stash clear