清空 commit 记录
有时候需要清空已有仓库的 commit 历史,可以使用以下方法:
git checkout --orphan <new_branch>
git add .
git commit -m "init repo based on <commit_id>"
git branch -D master
git branch -m master
git remote set-url origin <new_remote_url>
git push origin master
有时候需要清空已有仓库的 commit 历史,可以使用以下方法:
git checkout --orphan <new_branch>
git add .
git commit -m "init repo based on <commit_id>"
git branch -D master
git branch -m master
git remote set-url origin <new_remote_url>
git push origin master