Background
In some circumstances it will make sense to remove commit history from a GitHub repo. On public repositories you might want to do this if you have previously had a private repo, but you don’t wish the public to see history of the code.
Steps to Remove Commit History from GitHub
Here are the steps for removing the commit history:
- Checkout
git checkout --orphan latest_branch
- Add all the files
git add -A
- Commit the changes
git commit -am "commit message"
- Delete the 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
Warning: Your commit history is now history.