You are one bad command away from losing hours of work, context, and confidence. This quick snip gives you a controlled recovery sequence for the most common stash disasters: wrong stash, dropped stash, conflicts on apply, or zero memory of what was stashed in the first place.
60-Second Recovery Flow
- Identify the stash entry.
- Inspect patch details before applying.
- Recover on a safe branch first.
- Only then move changes where you need them.
Step 1: Identify and Inspect the Right Stash
# List all stashes with index
git stash list
# Quick summary of changed files
git stash show stash@{0}
# Full patch review before applying
git stash show -p stash@{0}
Step 2: Recover Safely on a Throwaway Branch
If this stash is critical, never apply it directly on your main branch.
git switch -c stash-recovery-temp
git stash apply stash@{0}
Now you can inspect, test, and cherry-pick confidently.
Step 3: Apply vs Pop (Choose Intentionally)
# Keep stash entry for fallback
git stash apply stash@{0}
# Apply and remove stash entry
git stash pop stash@{0}
Use apply when you are uncertain. Use pop only when you are sure.
Step 4: Recover a Dropped Stash
# Find dangling commits that may include dropped stash content
git fsck --no-reflog | grep dangling
# Inspect candidate commit
git show <commit-sha>
# Recover onto a new branch when confirmed
git switch -c stash-restore-<date>
git cherry-pick <commit-sha>
Habit That Saves You Repeatedly
Name stashes when creating them so recovery is instant and readable:
git stash push -m "wip/auth-rate-limit-fix"
Future you will thank present you.