Skip to content

Instantly share code, notes, and snippets.

View leocunhadev's full-sized avatar

Léo Cunha leocunhadev

View GitHub Profile
@leocunhadev
leocunhadev / stash_dropped.md
Last active October 26, 2021 02:12 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.