Back to Articles
gitdevtoolsprogramming

Accidentally Dropped Your Git Stash? Here’s How to Get It Back in 2 Minutes

March 11, 2026
2 min read
Accidentally Dropped Your Git Stash? Here’s How to Get It Back in 2 Minutes

Step 1: Find the Dropped Stash

Run:

bash
git fsck --no-reflogs | grep commit

Example output:

bash
dangling commit 738c25ced505b1cd58a64acce22a047d05681811

This dangling commit is your dropped stash.


Step 2: Inspect the Stash Contents

bash
git show --name-only 738c25ced505b1cd58a64acce22a047d05681811

This lists the files stored in that stash.


Step 3: Switch to the Target Branch

bash
git switch your-branch-name

Step 4: Restore the Stash

bash
git stash apply 738c25ced505b1cd58a64acce22a047d05681811

Verify the recovery:

bash
git status

Your files should now be restored.


Example

Lost files

  • 7 modified files
  • 8 new untracked files

Recovery steps

bash
# Find the dropped stash
git fsck --no-reflogs | grep commit
dangling commit 738c25ced505b1cd58a64acce22a047d05681811

# Inspect stash contents
git show --name-only 738c25ced505b1cd58a64acce22a047d05681811

# Switch branch
git switch feat/super-page

# Recover files
git stash apply 738c25ced505b1cd58a64acce22a047d05681811

Result: All files restored successfully.


Why This Works

git stash drop removes the reference to the stash but does not immediately delete the underlying data.
Git keeps it as a dangling object in the repository for roughly 30 days, allowing recovery.


Prevention Tips

Use aliases

bash
git config --global alias.sp "stash pop"
git config --global alias.sd "stash drop"

Check stashes before applying

bash
git stash list
git stash show

Add descriptive stash messages

bash
git stash -u -m "dashboard work in progress"

Multiple Dropped Stashes

If git fsck returns multiple dangling commits:

bash
git show --name-only <commit-hash>

Identify the correct one and apply it.


Summary

  • Dropped stash does not mean lost data
  • Git retains the data for ~30 days
  • Recovery requires only four commands

Keep Reading

Shubham

Shubham

Full Stack Developer