本文介绍了如何删除github中的所有提交历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想删除所有提交历史记录,但将代码保持为当前状态。 因为在我的提交历史记录中,有太多未使用的提交。 我该怎么做? 有没有任何git命令可以做到这一点? git filter-branch? git rebase? ... 我在github.com上的代码主机。解决方案删除 .git 文件夹可能会导致您的git存储库出现问题。如果您想删除所有提交历史记录,但保持代码处于当前状态,则执行以下操作非常安全: 结帐 git checkout --orphan latest_branch 添加所有文件 $ b $ git add -A li> 提交更改 git commit -am提交消息 删除分支 git branch -D master $ git branch -m master 最后,强制更新您的存储库 git push -f origin master PS:this不会将您的旧提交历史记录保存在中I want to delete all commit history , but keep the code in current state .because in my commit history , there are too many unused commit .How can i do it ?is there any git command can do this?git filter-branch ?git rebase ?...my code host in github.com. 解决方案 Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following:Checkoutgit checkout --orphan latest_branchAdd all the filesgit add -ACommit the changesgit commit -am "commit message"Delete the branchgit branch -D masterRename the current branch to mastergit branch -m masterFinally, force update your repositorygit push -f origin masterPS: this will not keep your old commit history around 这篇关于如何删除github中的所有提交历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-04 19:52