Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

How can you recover a dropped stash?

AdvancedConceptUndoing changes: reset, revert, restore and reflog
Answer

A dropped stash commit becomes dangling but is still in the object store until pruned. List dangling commits and inspect them.

git fsck --no-reflogs --unreachable | grep commit
git show <sha>
git stash apply <sha>
All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog