I followed the directions here in order to recover a stash I deleted by mistake, but when I try to apply it, I get an error message:
boonie@elementary:~/akanbar-system$ git fsck --unreachable
Checking object directories: 100% (256/256), done.
Checking objects: 100% (702/702), done.
unreachable commit 0f34656bf920ac827702190de57459f77e8310ec
unreachable blob 3af4303a950ade7cca4c8c20b10404bc95b30605
unreachable commit f7142808a8b972f7ec259ca4a3c71c10a9549396
boonie@elementary:~/akanbar-system$ git stash apply 0f34656bf920ac827702190de57459f77e8310ec
'0f34656bf920ac827702190de57459f77e8310ec' is not a stash-like commit
I've tried searching for a solution but I can't find any. Please help!
Solution: Guys, I'm not sure how exactly this worked, but I applied the second unreachable commit instead of the first one (which was the one I wanted) and it restored everything back. They must have been connected somehow. Hopefully this helps someone in the future, and if not, someone who answers with another method below will also help!
Recover lost stashed
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
you can get it by reset or checkout to another branch.
for Reset:
git reset -- hard <hashCode>
for Checkout:
git branch <desire_branch_name> <hashCode>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With