Delete All Commit History in Github.
I was wondering if I can delete all commit history in Github, especially for those newly published projects that you commit six times to fix a comma in the README.md file.
Apparently, deleting the
.git directory is a terrible idea, because that creates many problems in your repository.
The best solution is to check out a new branch, add all files to it, commit, delete the master branch, and then rename the new branch to master.
Steps to do that:
git checkout --orphan latest_branch
Add all the files
git add -A
git commit -am "message"
Delete the master branch
git branch -D master
Rename the current branch to master
git branch -m master
Finally, force update your repository
git push -f origin master