This content originally appeared on DEV Community and was authored by Axorax
I have deleted my git commit history plenty of times just to make my repository look “clean” (roast me in the comments for it). It’s probably best to not do this but I will still share how to do it.
Delete entire commit history
git checkout --orphan latest_branch
git add -A
git commit -am "commit message"
git branch -D main
git branch -m main
git push -f origin main
I did not figure this out myself or anything. I got it from here -> https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github
It’s by Desta Haileselassie Hagos, later edited by creyD
This content originally appeared on DEV Community and was authored by Axorax