0

My system crashed when I was in the middle of git initial commit. After the machine restarted, I noticed error with the initial commit. So I ran 'git reset --hard origin/master' command. After this command it deleted all the files locally and didn't see anything either in git or local folder. I don't have any clue what happened to my files. Is there any way to restore the files?

Yass
  • 592
  • 1
  • 8
  • 30
  • 1
    Files that are not in any commit are not in Git. Using `git reset --hard` tells Git *I don't need any of the files that are not in Git, so overwrite them*. Git can't get them back because they weren't in Git in the first place. In your particular case, if you had run `git add`, those files were "halfway" into Git and you may be able to get their *contents* back, but not their names. – torek Apr 26 '22 at 02:33
  • https://stackoverflow.com/search?q=%5Bgit%5D+undo+hard+reset , https://stackoverflow.com/search?q=%5Bgit%5D+recover+hard+reset – phd Apr 26 '22 at 12:36

0 Answers0