I was trying to recover a single file from an old commit in my git repository through the command line and I accidentally reverted the entire commit to my very first commit (this was made in December) and now I can't see any other git pushes?
Have I just lost all of my data or is there a way to restore it?
As this site states, you can do the following:
git reflog
and look for a commit that contains your file. Remember the commit hash.git checkout <commit hash> <path/to/file>
or merge the commit with your head (git merge <commit>
).See the docs for git reflog, git checkout and git merge for details.