小墨の博客

梦想需要付诸行动,否则只能是梦

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 checkout --orphan latest_branch

git add -A

git commit -am "commit message"

git branch -D master

git branch -m master

git push -f origin master



参考:https://blog.csdn.net/weixin_34050005/article/details/94077456

关键词:git合并所有提交

张小弟之家

本文链接:
文章标题:

本站文章除注明转载/出处外,均为原创,若要转载请务必注明出处。转载后请将转载链接通过邮件告知我站,谢谢合作。本站邮箱:admin@only4.work

尊重他人劳动成果,共创和谐网络环境。点击版权声明查看本站相关条款。

    发表评论:

    搜索
    本文二维码
    标签列表
    站点信息
    • 文章总数:508
    • 页面总数:20
    • 分类总数:92
    • 标签总数:208
    • 评论总数:61
    • 浏览总数:225323

    | | |
    | |  Z-Blog PHP