Git - Clear Commit History

Wednesday, December 25th 2019git

Copied shamelessly from StackOverflow

  1. Checkout to an orphan branch
git checkout --orphan temp_branch
  1. Add all files and commit
git add -A
git commit -am "commit message"
  1. Delete the branch
git branch -D master
  1. Rename current branch to master
git branch -m master
  1. Force push to remote
git push -f origin master