I messed up with git after running git reset --hard HEAD~3 and lost 2 hours worth of work. I then found a post on here that explained git reflog.
When I want to return to “git reset HEAD@{1}“, how do I not only return, but have all files that were removed put back in their directories?
You will need to move the branch that you want to be at that point with
git branch -f master HEADThe above example moves the branch
masterto HEAD. So it requires HEAD to be at the point you want to move the branch to. If that isn’t the case you can use the commit hash or reflog entry instead of HEAD.If you never commited the files before the
--hardreset, the work is gone. Git will only be able to recover what you commited.