Skip to content

Instantly share code, notes, and snippets.

@tenthree
Last active November 22, 2024 06:39
Show Gist options
  • Save tenthree/64b91134b10eb416fbb9a900be1e090e to your computer and use it in GitHub Desktop.
Save tenthree/64b91134b10eb416fbb9a900be1e090e to your computer and use it in GitHub Desktop.
Find dropped stash after closing the terminal
# find dangling commit hash in the git history
git fsck --no-reflog | awk '/dangling commit/ {print $3}'

# view in git log
glog $(git fsck --no-reflog | awk '/dangling commit/ {print $3}')

# then apply it back
git stash apply {dropped_stash_hash}

# or recover it in a new branch
git branch recovered {dropped_stash_hash}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment