码迷,mamicode.com
首页 > 其他好文 > 详细

git删除所有历史提交记录,只留下最新的干净代码

时间:2018-12-27 15:40:13      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:rename   final   number   let   commit   ber   ges   out   mes   

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删除所有历史提交记录,只留下最新的干净代码

标签:rename   final   number   let   commit   ber   ges   out   mes   

原文地址:https://www.cnblogs.com/leoking01/p/10184514.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!