Recovery
Recover a lost stash
When stash entries seem to disappear, determine whether they were popped, dropped, or detached from refs, then recover via reflog or dangling commits.
- Anyone actively handling a Git mistake
- Readers who want a conservative rescue habit before trouble happens
- Stop mutating the repo further
- Be ready to inspect `git reflog`, `git status`, and `git log --graph`
- Running more reset or rebase commands before preserving a checkpoint
- Changing shared history before assessing blast radius
Citations & Further Reading
- Git stash [Official]
- Git reflog [Official]
- Git fsck [Official]
What you will learn
- Understand the core purpose of Recover a lost stash
- Master the basic usage and common options of Recover a lost stash
- When stash entries seem to disappear, determine whether they were popped, dropped, or detached from refs, then recover via reflog or dangling commits.
- Understand key concepts: Identify the loss type first
- Know when to use this feature and when to avoid it
A “missing stash” is often a missing reference, not immediate data destruction.
Start with a problem
You just ran a Git command and the result wasn't what you expected — maybe you even lost some commits. This has happened before, and you want a reliable set of recovery techniques.
Identify the loss type first
- stash was popped and no longer listed
- stash was dropped or cleared
- stash commit still exists but ref moved
Stash history
HEAD@{3}HEAD@{2}HEAD@{1}Current
Recovery action
rescue/recover
First checks
git stash list
git reflog show stash
git reflog
If stash reflog exists, recover from there first.
If stash list is empty
Search dangling objects and inspect candidates:
git fsck --no-reflog | rg dangling
git show <commit>
When you find the target, preserve it immediately:
git switch -c rescue/stash-recovery <commit>
Recovery options
- restore patch only:
git show <commit> > rescue.patch - restore working changes: apply stash ref or cherry-pick from rescue branch
Repeated apply/pop attempts on your active branch can worsen state confusion. Preserve evidence first.
Good follow-up reads
Try it yourself
- Practice the recover-lost-stash command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: