How to recover from accidental deletion of Stash in Git

Asked 2 years ago, Updated 2 years ago, 38 views

I'm looking for Stash to fix the bug and work on it again, but it's not there...

I think it's gone. Is there a way to recover the erased Stash?

git

2022-09-22 19:49

1 Answers

https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git

I succeeded by referring to this... It was only about an hour and a half of work, but I think I'll fly away after I recover.

When I ran the command git fsck --no-reflog | awk'/dangling commit/ {print$3}' in the project folder, the hash of the commits came out.

When the hash value shown is sdag87s9fxg879dgdf

Type git show sdag87s9fxg879dgdf and you'll see a list of files.

If you find the missing commit, copy the hash value of the line

git stash application sdag87s9fxg879dgdf and it's restored.


2022-09-22 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.