I had two commits yesterday and couldn't push because I didn't have an internet connection. After that, I wrote some code and realized it's pretty messy and wanted to revert it to a HEAD commit. I did
git reset --hard HEAD and some of my files (I'm pretty sure I commited) were lost. Now I'm looking at a week old version and my git status says
Your branch is ahead of 'origin/master' by 2 commits. Some of the 'lost' files are listed in my git status as modified even though they are empty files on my system (just the include header).
Is my code recoverable?
If you really made commits you can see the revision history with
git reflog. It lists all actions done on your clone independently of branches and tags.
However if you did
git reset --hard HEAD on a repo with local changes (staged or not) they are lost - this seems to be your case. When running
git log do you still see the 2 commits you made yesterday in the log? This is indicated by the message Your branch is ahead of 'origin/master' by 2 commits.