Collin Henderson
Collin Henderson

Reputation: 1154

Deleted all files in fresh repo with accidental git reset --hard

I was working on some code, which didn't have any kind of git repo set up. I ran:

git init git remote add origin http://giturl.git

then I ran git add -A and realized I forgot to create a .gitignore file.

For some reason I ran git reset --hard ...oops, that was dumb.

It deleted all the files in the folder, and I have no clue how, or if it's even possible to get them back.

Upvotes: 1

Views: 49

Answers (1)

Collin Henderson
Collin Henderson

Reputation: 1154

Fortunately, I was saved by running git fsck --lost-found. Because I had at least ran git add -A, I just had to sift through the blobs to get the data I needed back.

Upvotes: 1

Related Questions