如何从Git存储库中的提交历史记录中删除/删除大文件?

二次信任 提交于 2020-05-07 08:57:38

问题:

Occasionally I dropped a DVD-rip into a website project, then carelessly git commit -a -m ... , and, zap, the repo was bloated by 2.2 gigs. 有时,我将DVD-rip放入一个网站项目中,然后不小心git commit -a -m ... ,然后,zap的回购膨胀了2.2个演出。 Next time I made some edits, deleted the video file, and committed everything, but the compressed file is still there in the repository, in history. 下次我进行一些编辑,删除视频文件并提交所有内容,但是压缩文件仍在历史记录中。

I know I can start branches from those commits and rebase one branch onto another. 我知道我可以从这些提交开始分支,并将一个分支重新建立到另一个分支。 But what should I do to merge together the 2 commits so that the big file didn't show in the history and were cleaned in garbage collection procedure? 但是,我应该怎么做才能将2个提交合并在一起,以便大文件不显示在历史记录中,并在垃圾回收过程中清除?


解决方案:

参考一: https://stackoom.com/question/8oXb/如何从Git存储库中的提交历史记录中删除-删除大文件
参考二: https://oldbug.net/q/8oXb/How-to-remove-delete-a-large-file-from-commit-history-in-Git-repository
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!