删除所有git历史记录 @ shenmo | 0001-01-01T00:00:00Z | 1 分钟阅读 | 更新于 0001-01-01T00:00:00Z

发布时间: 2022-05-19T16:00:37+08:00

原文链接:https://blog.csdn.net/yc1022/article/details/56487680

1.Checkout

git checkout –orphan latest_branch

  1. Add all the files

    git add -A

  2. Commit the changes

    git commit -am “commit message”

  3. 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

————————————————

版权声明:本文为CSDN博主「yanchengyc」的原创文章,遵循CC 4.0 BY-SA版权协议

方便直接使用:

 git checkout --orphan latest_branch
 git add -A
 git commit -am "重置仓库到最新一次commit"
 git branch -D master
 git branch -m master
 git push -f origin master

注意:Gitee上还需要进行储存库GC来清理占用空间

© 2019 - 2024 shenmo的世界

Hugo theme Dream.

辽ICP备2021012180号-1

上面有备案号的

avatar
关于我

星火应用商店项目 Leader

社交链接

本博客所有文章使用《知识共享 署名-非商业性使用-相同方式共享 4.0》(CC-BY-NC-SA-4.0)协议

这意味着你可以在署名并标明出处的情况下进行非商业转载(转载的文章也需要遵守CC-BY-NC-SA-4.0协议),但不可以进行商业转载