2

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

1
  • 1
    Keyword to google: reflog Commented Mar 9, 2017 at 0:45

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.