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
Axorax | Sciencx (2024-07-26T00:34:35+00:00) How to delete entire git commit history?. Retrieved from https://www.scien.cx/2024/07/26/how-to-delete-entire-git-commit-history/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.