1

I was trying to squash my commits and went too far back, now all my files have been deleted.

I attempted a git reset HEAD@{0} but this ended up with a "Unstaged changes after reset:" and a list of the DELETED files. The files had not been restored.

How do I restore the files?

EDITED to note that I also did not commit the most recent changes I had made but I had done a git add . and I need those changes back

1 Answers1

1

Perhaps the easiest fix you could try now would be to just hard reset your local branch to is remote tracking branch. Assuming your local branch is called local, you may try:

# from local
git reset --hard origin/local

This would leave your local branch in the state it was last time you committed. If you have already committed the result of the squash, then this approach won't work. In that case, you might have to git reflog and try to find the commit to which you want to reset your branch.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360