I added a new file
F1 and made changes to another file F2 but then did a
git reset --hard HEAD^ and I have lost all the changes to the files.
Is there some way, I can get them back?
I did look at a related question here: How can I undo git reset –hard HEAD~1? but, that question assumes that the one has done a Git commit.
You can (with some work) recover state of file at the last "git add <file>". You can use
$ git fsck --cache --no-reflogs --lost-found --dangling HEAD
and then examine files in ‘.git/lost-found/other’ directory.
Please read git fsck manpage.
Answered By – Jakub Narębski