Skip to content

清除git所有历史

清除git所有历史

⚠️ 危险操作警告

本文包含强制推送(git push -f)操作,这将永久删除 Git 历史记录。在执行之前,请确保:

  • 你已经备份了重要的代码和历史
  • 你完全理解这个操作的后果
  • 这是你个人仓库或你已获得团队授权
  • 一旦执行,历史记录无法恢复

{style=”warning”}

为什么会需要这个呢?

1
2
3
4
5
6
git checkout --orphan new-branch
git add -A
git commit -m "It's hurricane."
git branch -D main
git branch -m main
git push -f origin main

About this Post

This post is written by KaranocaVe.

#Git #版本控制