JohnSnow
JohnSnow

Reputation: 7111

does git reset HEAD^ --hard delete everything?

I was finished a project, I got a merge conflict, so I stupidly ran git reset HEAD^ --hard and now all my files are gone except my node modules folder (which was in .gitignore). Is there anyway I can recover my files?

I'm using VScode

Upvotes: 2

Views: 408

Answers (1)

JSelser
JSelser

Reputation: 3630

As zerkms well said, you haven't lost everything yet, git closely follows what was done, so you can search for your commit via:

git reflog

And when you find the one that references your lost work just do

git reset --hard <commit-ref>

You can check if your stuff is there by git show HEAD

Here is a more in depth guide: http://effectif.com/git/recovering-lost-git-commits

Upvotes: 5

Related Questions