Revert Back To Previous Commit Without History

Revert Back To Previous Commit Without History

I’ve faced this many times that I made a mistake (added credentials or something else to code) and I deleted the entire repository on Github.

The two commands below can be used to solve this problem:

git reset --hard <commit_hash>
git push origin main --force

You can find the commit_hash in commit history of your repository.