1
删除所有git commit
source link: https://blog.leixin.wang/50675bd.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
删除所有git commit
记录一下,删除所有git commit的方法,但不改变原有代码的方式
# 1. 将当前分支备份
git checkout --orphan backup
# 2. 添加文件到备份分支
git add -A
# 3. 提交
git commit -am "commit message"
# 4. 删除分支
git branch -D master
# 5. 把当前分支重命名为备份的分支
git branch -m master
# 6. 强制更新代码到远程分支
git push -f origin master
不要问我为什么会有这篇文章,说多了都是泪,我的历史提交啊。。。
- 本文作者: MKing
- 本文链接: http://www.leixin.wang/50675bd.html
- 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK