如何删除GitHub中的所有以前提交的记录?
有的时候想把项目之前提交的记录给清除,该如何做呢?
先把项目 Clone 到本地
git clone 项目地址
Checkout
git checkout --orphan latest_branch
Add all the files
git add -A
Commit the changes
git commit -am "commit message"
Delete the branch
git branch -D main
Rename the current branch to main
git branch -m main
Finally, force update your repository
git push -f origin main
来源:https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Vincent's Blog!