1.切换到新的分支

git checkout --orphan latest_branch

  2.缓存所有文件(除了.gitignore中声明排除的)

 git add -A

  3.提交跟踪过的文件(Commit the changes)

 git commit -am "commit message"

  4.删除master分支(Delete the branch)

git branch -D master

  5.重命名当前分支为master(Rename the current branch to master)

 git branch -m master

  6.提交到远程master分支 (Finally, force update your repository)

 git push -f origin master

  通过以上几步就可以简单地把一个Git仓库的历史提交记录清除掉了。

 

出处:https://www.cnblogs.com/msxh/p/11082246.html 

 

相关文章:

  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2019-10-30
  • 2021-08-15
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2021-11-07
  • 2021-09-19
  • 2021-07-24
  • 2021-10-14
  • 2022-12-23
  • 2018-08-27
  • 2020-11-17
相关资源
相似解决方案