Next.js starter your AI actually understands. Ship internal tools in days not weeks. Pre-order $199 $499 → [Get it now]

How to recover lost stash in Git

Recovering lost Git stashes is possible even after dropping or clearing stashes using reflog and fsck commands. As the creator of CoreUI with over 25 years of software development experience, I’ve recovered numerous accidentally dropped stashes. Git retains stashed changes as dangling commits for a period, allowing recovery after stash drop or clear operations. This approach ensures no work is permanently lost when stashes are accidentally removed.

Use git reflog and git fsck to find and recover dropped or cleared stashes.

Recover recently dropped stash:

# You dropped a stash
git stash drop stash@{0}

# View reflog for stash operations
git reflog | grep stash

# Output shows:
# abc1234 refs/stash@{0}: WIP on main: commit message
# def5678 refs/stash@{1}: WIP on main: previous stash

# Apply the dropped stash
git stash apply abc1234

# Or create branch
git branch recovered-stash abc1234

Recover after stash clear:

# You cleared all stashes
git stash clear

# Find stash commits in reflog
git fsck --unreachable | grep commit

# Output shows dangling commits
# unreachable commit abc1234...
# unreachable commit def5678...

# Check each commit
git show abc1234

# If it's your stash, apply it
git stash apply abc1234

List all lost stashes:

# Find all dangling commits
git fsck --no-reflog | grep commit | awk '{print $3}'

# Script to check each one
for commit in $(git fsck --no-reflog | grep commit | awk '{print $3}'); do
  echo "=== $commit ==="
  git log -1 --oneline $commit
done

# Apply the right one
git stash apply <commit-hash>

Best Practice Note

Git stash commits remain available for recovery for 90 days by default. Use git reflog to find recently dropped stashes. Use git fsck when stash was cleared. Create branches from recovered stashes for safety. Check stash content with git show before applying. This is how we recover stashes in CoreUI development—using reflog and fsck to restore accidentally dropped work without permanent data loss.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
How to set focus on an input field after rendering in React
How to set focus on an input field after rendering in React

How to loop through a 2D array in JavaScript
How to loop through a 2D array in JavaScript

How to change opacity on hover in CSS
How to change opacity on hover in CSS

Dealing with Sass Deprecation Warnings in Angular 19
Dealing with Sass Deprecation Warnings in Angular 19

Answers by CoreUI Core Team