How to Recover a Lost Git Stash (Even After drop or clear)
You ran git stash drop on the wrong entry, or git stash clear wiped everything. The stash list is empty. The work appears gone. It is almost certainly not — Git keeps the underlying commits around until garbage collection runs. Here is how to get them back.
Why dropped stashes are recoverable
When you stash changes, Git creates real commits — one for the index state and one for the working tree. These commits exist in the object store even after git stash drop removes the refs/stash pointer. Until git gc collects unreachable objects (usually after 30–90 days), you can find and restore them with git fsck.
Step 1 — Find dangling commits
Run git fsck to list every commit that exists in the object store but is no longer referenced by any branch, tag, or stash entry:
git fsck --no-reflogs --unreachable | grep "commit"You will get output like this:
unreachable commit a1b2c3d4e5f6...
unreachable commit 9f8e7d6c5b4a...
unreachable commit 1234567890ab...Each hash is a commit that is no longer pointed to by anything. Your lost stash is in this list.
Step 2 — Inspect each commit to find your work
Stash commits have a distinctive format. Preview each unreachable commit with git show to find the one containing your changes:
git show a1b2c3d4e5f6 --stat # shows changed files
git show a1b2c3d4e5f6 # shows full diff
A stash commit typically shows a message like "WIP on main: abc1234 Your last commit message" and the diff of your stashed files. If the diff looks right, that is your stash.
If you have many unreachable commits, pipe the hashes through a loop: git fsck --no-reflogs --unreachable | grep "commit" | awk '{print $3}' | xargs -n1 git log --oneline -1 — this prints one summary line per commit so you can scan them quickly.
Step 3 — Apply or restore the stash commit
Once you have identified the correct commit hash, you have two options:
Option A — Apply the changes directly (no new branch needed):
git stash apply a1b2c3d4e5f6This replays the stash diff onto your current working tree, exactly like a normal git stash apply.
Option B — Recreate it as a named stash:
git update-ref refs/stash a1b2c3d4e5f6 -m "recovered stash"This brings the commit back into your stash list as stash@{0}. From there you can use git stash apply or git stash pop as normal.
Option C — Check it out as a branch (safest for reviewing first):
git checkout -b recovered-stash a1b2c3d4e5f6This gives you a branch at the stash commit so you can inspect the full diff before deciding what to keep.
Special case: recovering after git stash clear
git stash clear drops all stash entries at once, but the commits survive exactly the same way. The git fsck approach above finds all of them. If you had multiple stashes, you will see multiple unreachable commits — inspect each one and apply them in whatever order makes sense.
This only works until Git's garbage collector runs and prunes unreachable objects. The default grace period is 30 days for unreachable commits and 90 days for reflogs. If you dropped the stash more than a month ago on a repo with regular GC runs, the commits may already be gone. Act quickly.
Preventing future stash loss
The simplest prevention is to name your stashes before dropping them into an untracked pile:
git stash push -m "WIP: payment form validation" # named stash
git stash list # shows all with namesNamed stashes are much easier to identify in the list and less likely to be accidentally dropped. For work you want to keep longer than a day, committing to a short-lived branch is safer than stashing — commits are always in the reflog, stash entries are not.
Quick reference
| Command | What it does |
|---|---|
| git fsck --no-reflogs --unreachable | grep commit | Find all dangling commits including dropped stashes |
| git show <hash> --stat | Preview which files a dangling commit touched |
| git stash apply <hash> | Apply a dangling commit as if it were a stash |
| git update-ref refs/stash <hash> | Restore the commit as stash@{0} |
| git checkout -b recovered <hash> | Create a branch from the dangling commit to review safely |
| git stash push -m "name" | Stash with a label so it is easier to find later |
30+ scenarios. Every reset, revert, reflog, and stash pattern documented with context on when to use each. One PDF, buy once.
Get Git Unfucked →