Skip to content

How to remove all git commit history

git checkout --orphan latest_branch
git add -A
git commit -am "your new commit message"
git branch -D main
git branch -m main
git push -f origin main

External Reference

https://clearinsights.io/blog/how-to-remove-all-git-commit-history/

https://gist.github.com/stephenhardy/5470814

https://xebia.com/blog/deleting-your-commit-history/

Comments