That’s it, I built a github page for a certain repo, which is an additional branch gh-pages. I used the automatic generator of the github web version to generate gh-pages.
Every time I update gh-pages, I will commit something to the gh-pages branch. The problem is that these historical records are of no use to me. I am worried that there are too many commits, taking up space and making them uncomfortable to look at.
Is there any way to erase all the history of this branch?
Delete this branch and create a new branch with the same name
Commit cannot be deleted. Even if you delete the branch, the commit record will not be deleted, so you cannot erase all branch history.
Of course, if you just want to make the branch look prettier, you can consider using
git rebase
to compress the commit and then force push the branch