Home > front end >  Restore all files from the commit
Restore all files from the commit

Time:07-09

I accidentally deleted all the project files and now I want to get everything back through a commit. How do I do this?

Git log shows one commit(head). There is no project on GitHub and no local copies either. My only option is this commit.

CodePudding user response:

To restore file, it is better to use the git restore command:

cd /path/to/repository
git restore -s <commitID> -- .

CodePudding user response:

I would try with

git reset --hard HEAD

According to this answer https://stackoverflow.com/a/66774203/13497410

  • Related