Files
Linux/Git/Git清除提交记录.md
offends cee91802b3
Some checks failed
continuous-integration/drone Build is failing
synchronization
2025-08-25 15:57:40 +08:00

496 B

作者:丁辉

清除GitHub中的所有提交历史记录

  1. 创建了一个新的分支

    git checkout --orphan latest_branch
    
  2. 添加所有文件

    git add -A
    
  3. 提交更改

    git commit -am "commit message"
    
  4. 删除分支

    git branch -D main
    
  5. 将当前分支重命名

    git branch -m main
    
  6. 最后,强制更新存储库

    git push -f origin main