如何从 Git 存储库中删除 blob
我不小心将数据库转储(超过 1 GB)添加到我的存储库中,将其推送并在几天后注意到这一点。
我使用 git filter-branch 删除了文件,过期的 reflog 并运行 git gc 来修剪未使用的对象,但数据库转储 blob 仍在存储库中。我使用了哪个提交有这个blob?< /em>,但我确实找到了任何引用该 blob 的提交。我如何删除它或者如何找出它在 git gc 期间没有被删除的原因?
I accidentally added a database dump (over 1 GB) to my repository, pushed it and noticed this few days later.
I used git filter-branch
to delete the file, expired reflog and ran git gc
to prune unused objects, but the database dump blob is still in the repository. I used Which commit has this blob?, but I did find any commit which has a reference to the blob. How can I delete this or how do I find out why it didn't get deleted during git gc
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
运行 git gc 时您到底调用了哪个命令?
请注意 git gc 的联机帮助页:
因此如果您的 blob 小于 14 天,您必须致电
Which command did you call exactly when running git gc?
Note the manpage of git gc:
So if your blob is younger than 14 days, you have to call
只需执行 rm .git/objects/path/to/blob 即可。
我不知道为什么 git-gc 没有删除它。
Just do
rm .git/objects/path/to/blob
.I am not sure why
git-gc
didn't delete it.