Delete all commit records from Github without deleting the source
- Do a temporary checkout
git checkout --orphan temp - Commit the changes
git commit -am "cleaning" - Delete the branch
git branch -D main - Rename the current branch to main
git branch -m main - Finally, force update your repository
git push -f origin main

At times we push the wrong update to the repository. In spite of fixing the issue at a later stage, we just hope that we never have pushed the wrong code. We have a workaround for this. Click here to know How to delete all commit records from Github without deleting the source
Share this article
