The reflog shows that you have just two commits in your repository:
287e9ccb
, which is your initial commit
25a289ec
, which is probably the result of running git revert 287e9ccb
The initial commit has, as its snapshot, all of the files you committed. The difference between this commit and the previous (non-existent) commit is, if you ask Git for it, add all these files with these contents.
If the second commit is a revert of the first (as its log message implies), it contains the result of undoing the first commit: i.e., removing all the files. So the second commit has an empty source tree.
The only things that Git stores forever / permanently1 are the commits themselves. The files that you work with, that you can see and edit, are temporary. Extracting a commit replaces those files by removing those files2 and putting in the ones from the commit you've chosen.
This means that at least as far as Git goes, all you can get back are these two commits: the first one, and the one that undoes the first one. If you need file contents that were not saved into either of these two commits, you will have to get them from something other than Git.
1Even commits themselves are only as permanent as they are findable by hash ID. Typically you (or Git) will start with a branch or tag name to get one particular hash ID. That lets you find that commit. That commit then contains the hash ID of its previous, or parent, commit, which lets Git find the parent commit. The parent contains the hash ID of another earlier commit, and so on: this goes back to the very first commit, which—being first—doesn't record any earlier commit, and then Git stops.
In other words, Git works backwards. You find the hash ID of the last commit, from a branch name, and then Git works backwards. What git reset
does is let you move branch names to any commit hash ID. From there, you can only look backwards.
The reflog holds all the hash IDs that the name held in the past, up to some point anyway. (Reflog entries eventually expire so that the reflogs don't get infinitely long.) So if you reset away a commit, and can't find it, the hash ID of the later commit that the name used to find will be in your reflog.
Unfortunately, git reset --hard
means please destroy my temporary copies of files that are in the index and in my work-tree. If you haven't committed them, you cannot get them back.
2Git uses some cleverness to avoid removing a file and then replacing it with the same content. Since most commits mostly re-use some other commits' files, this saves a lot of time when switching from one commit to another. It also helps a lot with some build systems (e.g., make
or one of its derivatives).