Recover a stash you dropped or cleared
I ran git stash drop (or git stash clear) — can I get the stash back?
Short answer
Stashes are stored as real commit objects, so dropping one only removes it from the stash list — the commit itself survives as an unreachable object. git fsck --unreachable finds it, and git stash apply <hash> puts the work back.
git fsck --unreachable | grep commit
Lists orphaned commits, including every stash you dropped
Does this match your situation?
- You ran git stash drop and realised you needed it.
- git stash clear wiped the whole stack.
- git stash list is empty but you know you stashed something.
- A stash pop hit a conflict, you aborted, and the stash seems gone.
Step-by-step fix
Check the stash list first
Occasionally the stash is still there and you were looking at the wrong repository or branch. It costs nothing to rule out.
step 1git stash listFind unreachable commits in the object database
Every stash entry is a commit whose message starts with 'WIP on' or 'On <branch>'. Once dropped it becomes unreachable but still exists, and fsck will list it.
step 2git fsck --unreachable | grep commitShow the PowerShell (Windows) version
PowerShell (Windows)git fsck --unreachable | Select-String 'unreachable commit'Narrow the list down to actual stashes
A large repository can report many unreachable commits. Stash commits are distinctive: they're merge commits with a WIP message, so you can filter for them directly instead of inspecting each one.
step 3git fsck --unreachable | awk '/unreachable commit/ {print $3}' | xargs git log --merges --no-walk --onelineShow the PowerShell (Windows) version
PowerShell (Windows)git fsck --unreachable | Select-String 'unreachable commit' | ForEach-Object { ($_ -split ' ')[2] } | ForEach-Object { git log --merges --no-walk --oneline $_ }Look for messages like 'WIP on main: a1b2c3d Add inventory' — that's your stash.
Inspect the candidate, then restore it
Check the diff before applying so you know you've got the right stash. Then apply it like any other stash, or turn it into a branch if you'd rather review it in isolation.
step 4git stash show -p a1b2c3d # preview the contents git stash apply a1b2c3d # restore it into your working tree # or keep it separate: git branch recovered-stash a1b2c3d
Why this works
git stash is not a special storage format — it creates genuine commit objects (one for the working tree, one for the index, and optionally one for untracked files) and records the top one in the refs/stash reference. Dropping a stash pops an entry off that reference's log, leaving the commits unreferenced but physically present in .git/objects. Because they're ordinary commits, every normal Git command works on them, which is why git stash apply happily accepts a raw hash.
If that didn’t work
- Try git fsck --unreachable --no-reflogs, which reports objects that reflog entries would otherwise mask.
- Look in .git/logs/refs/stash — the stash's own reflog may still list dropped entries.
- If git gc has already run with --prune=now, the objects are genuinely gone; fall back to your editor's local history.
How to stop it happening again
- Always label stashes: git stash push -m "inventory UI half done" makes the list readable.
- Prefer git stash apply over pop — apply leaves the stash in place until you're sure it worked.
- For anything you'd be upset to lose, commit to a scratch branch instead of stashing.
Commands used in this guide
Still stuck?
Search the full command reference and every other rescue guide — there are 56 of them, covering everything from detached HEAD to force-push disasters.
Browse all guides →Frequently asked questions
Does git stash drop delete the stashed changes permanently?
Not immediately. It removes the entry from the stash list, but the underlying commit objects remain in the repository until garbage collection prunes them. git fsck --unreachable will find them, and git stash apply accepts the raw commit hash.
How do I find a dropped stash's commit hash?
Run git fsck --unreachable and filter for commits. Stash commits are merge commits with a message beginning 'WIP on' or 'On <branch>', so piping the hashes through git log --merges --no-walk --oneline isolates them quickly.
What's the difference between git stash pop and apply?
Both restore the stashed changes, but pop also deletes the stash entry afterwards, while apply keeps it. Since pop drops the entry even in some conflict situations, apply is the safer habit — delete the entry manually once you've confirmed everything is fine.
Related rescue guides
I permanently deleted a file that was never committed — can I get it back?
It comes down to one question: was the file ever staged with git add? If it was, its contents are sitting in Git's object database as a dangling blob and git fsck will find it. If it was never staged and never committed, Git genuinely never saw the file and cannot help — but your editor's local history almost certainly can.
Read the fix →Usually recoverableI ran git reset --hard and lost my commits — how do I undo it?
Committed work is almost never really gone. git reflog lists every position HEAD has held, including the one just before your reset, so you can jump straight back to it with git reset --hard HEAD@{1}. Uncommitted changes that the reset wiped are a different story — those are only recoverable if they had been staged at some point.
Read the fix →Rarely recoverable by GitHow do I throw away all my local changes in Git?
git restore . discards edits to tracked files and git clean -fd deletes untracked ones. Both are irreversible for anything that was never staged or committed, so run git stash first if there's any doubt — it takes a second and makes the whole operation undoable.
Read the fix →Usually recoverableI deleted a Git branch — how do I get it back?
Deleting a branch removes a pointer, not the commits. Find the branch's last commit hash in the reflog and recreate the branch at that hash with git branch <name> <hash>. If the branch was pushed, the copy on the server may still exist and can simply be fetched back.
Read the fix →