2011-08-26 88 views
7

我不小心将数据库转储(超过1 GB)添加到我的回购库中,推送它并在几天后注意到。我使用git filter-branch删除文件,过期reflog并运行git gc来修剪未使用的对象,但数据库转储blob仍处于回购状态。我使用了Which commit has this blob?,但确实找到了任何提及blob的提交。我怎样才能删除这个或如何找出它在git gc期间没有被删除的原因?如何从git repo中删除blob

+1

请问http://stackoverflow.com/questions/2116778/reduce-git -repository-size/2116892#2116892帮忙吗?或http://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-big? – VonC

回答

13

运行git gc时,你准确调用了哪个命令?

注混帐GC的手册页:

可选配置变量gc.pruneExpire控制未引用的松散物多大是不得不被修剪之前。默认值为“2周前”

所以,如果你的斑点是年龄超过14天,你必须调用

git gc --prune=<date> (for date you also can insert now) 
+0

谢谢,我没有注意到pruneExpire选项,并没有意识到git一段时间内保留未被提及的对象。以前,我的确运行过git gc --prune --aggressive。现在,我在git gc --prune之前运行了git reflog --all --expire =,并删除了blob。 –

0

难道你不能只做rm .git/objects/path/to/blob

我不知道为什么git-gc没有删除它。

+10

当投票时,每个人都可以解释为什么。它可以帮助每个人在某个主题上阅读,从而了解为什么某些东西不太理想或者只是错误。 :) –

相关问题