if you didn’t hide the changes in the file while working (and then restored them), then you can do little with it.
if you added the file changes using git add (probably you have it because you were about to commit), then blob should already be in git db. you can use git fsck to search for dangling objects. look for blobs and check all of them - either using git show or git cat-file - (it takes time, I know ...), but if you're lucky, you will find the contents of your file. use git cat-file blob $hash_of_object > foo.c to restore the contents of your file
knittl
source share