首页 > 其他 > 详细

git 清空所有commit记录

时间:2019-06-26 19:52:47      阅读:147      评论:0      收藏:0      [点我收藏+]

说明:例如将代码提交到git仓库,将一些敏感信息提交,所以需要删除提交记录以彻底清除提交信息,以得到一个干净的仓库且代码不变

1.Checkout

git checkout --orphan latest_branch

2. Add all the files

git add -A

3. Commit the changes

git commit -am "commit message"

4. Delete the branch

git branch -D master

5.Rename the current branch to master

git branch -m master

6.Finally, force update your repository

git push -f origin master

git 清空所有commit记录

原文:https://www.cnblogs.com/liujinyu/p/11093027.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!