🔧 How to Recover a Lost Git Stash

You're exactly right. That's a great way to recover a stash that was accidentally dropped or lost (for instance, after a git stash pop that resulted in a conflict).

Here’s a breakdown of the process you described and why it works.


1. First Check: git stash list

You should always start with this command. It shows you the stack of all stashes Git is actively managing.

⎗
✓
git stash list

If you see your missing stash here (e.g., stash@{2}: WIP on main: ...), you don't need the reflog. You can just apply it directly using its identifier:

⎗
✓
git stash apply stash@{2}

2. If It's Not in the List: git reflog

If git stash list doesn't show your stash, it means the reference to it was deleted (like with git stash drop or a completed git stash pop). However, the stash itself is just a commit, and it likely still exists in your repository for a while before being garbage-collected.

This is where git reflog comes in. It shows a log of where your HEAD and branches have been.

⎗
✓
git reflog

When you run this, you're looking for the commit hash associated with the stash. Stash commits are typically labeled with a message like "WIP on [branch-name]: [commit-message]" or just "stash".

⎗
✓
1
2
3
e8f09d4 HEAD@{0}: stash: Created stash
a1b2c3d HEAD@{1}: commit: Added new feature
...

3. Recover the Stash: git stash apply

Once you identify the commit hash (e.g., e8f09d4) from the reflog, you can apply it just like a regular stash:

⎗
✓
git stash apply e8f09d4

This will re-apply the changes from that lost stash to your current working directory.

Edit

Pub: 01 Nov 2025 04:32 UTC

Views: 11