I was using atom text editor with a github integration when I somehow found myself with all my local personal desktop files (videos, images, notes, etc.) in the "unstaged" area. To get rid of it I clicked "discard changes" for all the files which removed them from my desktop and subsequent folders.
After realizing the fatal mistake I made the next day. I noticed a slightly transparent folder on my desktop labeled .git which is about 20gb worth now. I have looked into other posts but they haven't been much help. I've already closed atom and re-opened it, and pushed a request through last night, so simply clicking undo discard doesn't work. I was thinking about system restore, but maybe as a last resort.
If those files were added, not committed, they should be recoverable.
See "Introducing git-recover" from Edward Thomson, and its git-recover
script.
However, it might not know the file names to recover, and it seems to be a file-by-file process.
The OP Calvin Leung references "How To: Recover From a Git Hard Reset" from [Carrie Guss]6.
She gets all the missing blobs:
for blob in $(git fsck --lost-found | awk '$2 == "blob" { print $3 }'); do \
git cat-file -p $blob > $blob.txt; done
Then she uses that content to deduce the file names.