0

I was learning git and I had accdentally deleted unstaged files using git clean -xdf. I want to get them back

I tried git fsck --full --unreachable --no-reflog and now I have the dangling blob of it which looks like 3x1xd7x4090xd9x350x490d8xd76743x670xd0c5 How do I get the files back?

Jai
  • 1
  • 5
  • FYI, it's impossible to recover **unstaged** files using git object storage. If you found something interesting, it's that it has been stage. There are some interesting answers here: https://stackoverflow.com/q/11094968/717372 – Philippe Mar 24 '23 at 09:35

1 Answers1

3

If you have a dangling blob, you can use show or cat-file to display its contents:

git show 31d74090....

or

git cat-file -p 31d74090...

Standard shell IO redirection can be used to write a real file in your filesystem again.

knittl
  • 246,190
  • 53
  • 318
  • 364