删除我们肿的git历史的一部分 [英] Remove parts of our bloated git history
问题描述
我的问题:
在建立存储库的早期,就犯了一个错误,导致当时所有的图像都被写入到存储库中.此问题已在gitignore文件中迅速得到纠正,不再存在问题.
Early on when the repository was set up a mistake was made causing all the images at the time to be written to the repository. This was quickly rectified in the gitignore file and no longer presents a problem.
现在的问题是,我们有一个庞大的存储库,其中包含图像的历史记录.这在本地克隆存储库时会出现问题,因为它比从尖端进行干净克隆要花更长的时间.
The problem is now that we have an enormous repository which contains the history of the images. This presents a problem when cloning the repository locally as it takes a lot longer than a clean clone from the tip.
我的问题:
有没有一种方法可以删除历史记录中包含不需要的图像的部分?
Is there a way of removing the part of the history that includes the images which are never going to be needed?
如果我无法删除,是否可以以任何方式压缩甚至清除历史记录?
If I cannot remove can I compress or even cleanup the history in any way?
推荐答案
如果它正在删除历史记录的一部分,则使用git rebase interactive
If it is removing part of history - you use git rebase interactive
如果要删除文件(从所有版本中删除),请使用git filter-branch
if it is file removal (from all versions) use git filter-branch
这篇关于删除我们肿的git历史的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!