简体   繁体   English

如何从 git 历史记录中删除已删除的文件 - 包括 rev-list

[英]How to remove a deleted file from git history - including rev-list

I have tried filter-branch, and got to the point where it is removed from git log, but still in rev-list.我已经尝试过 filter-branch,并且已经将它从 git 日志中删除,但仍在 rev-list 中。 Then I tried bfg repo cleaner and it still is listed in rev-list.然后我尝试了 bfg repo clean ,它仍然列在 rev-list 中。 Ultimately I need it to be removed from rev-list because the file is missing from our git lfs server, which causes a git lfs fetch --all to fail...最终我需要将它从 rev-list 中删除,因为我们的 git lfs 服务器中缺少该文件,这导致 git lfs fetch --all 失败...

Aha.啊哈。 I found that there were some really old branches that had the file still in HEAD - so I had to use --no-blob-protection, Of course I will now go and check those branches as I know this is actually a dangerous action.我发现有一些非常旧的分支仍然在 HEAD 中保存文件 - 所以我不得不使用 --no-blob-protection,当然我现在会 go 并检查这些分支,因为我知道这实际上是一个危险的操作。 but at least bfg shows me these branches.但至少 bfg 向我展示了这些分支。 For any future searchers I would suggest running with protection to clear all normal branches - THEN run without protection so that you get ONLY the branches that have the file(s) in head.对于任何未来的搜索者,我建议在保护下运行以清除所有正常分支 - 然后在没有保护的情况下运行,以便您只获得头部包含文件的分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM