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.

Who This Is For
  • Anyone actively handling a Git mistake
  • Readers who want a conservative rescue habit before trouble happens
Prerequisites
  • Stop mutating the repo further
  • Be ready to inspect `git reflog`, `git status`, and `git log --graph`
Common Risks
  • Running more reset or rebase commands before preserving a checkpoint
  • Changing shared history before assessing blast radius

Citations & Further Reading

  1. Git stash [Official]
  2. Git reflog [Official]
  3. 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

  1. stash was popped and no longer listed
  2. stash was dropped or cleared
  3. stash commit still exists but ref moved
Recover Lost StashStash contents are not immediately deleted; the corresponding commit object may still be recoverable via reflog.
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
Create a rescue branch before applying anything

Repeated apply/pop attempts on your active branch can worsen state confusion. Preserve evidence first.

Good follow-up reads

  1. reflog recovery
  2. recover after reset
  3. git-stash

Try it yourself

  1. Practice the recover-lost-stash command in a test repository and observe state changes before and after
  2. Experiment with different options and compare the output differences
  3. 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: