我有一些創建git subtree
,我想垃圾收集(更多的任何實際目的只是爲了瞭解什麼和爲什麼可以收集)。垃圾收集提交git
我已經檢查了這些提交不被引用的有以下幾種:
# In any reflog
> git reflog --all --no-abbrev-commit | grep <hash>
(no output)
# In any branch, local or remote
> git branch --contains <hash>
(no output)
> git branch -r --contains <hash>
(no output)
# In any tag
> git tag --contains <hash>
(no output)
# In the current index
> git rev-list HEAD | grep <hash>
(no output)
# In references from filter-branch
> ls .git/refs/original/
(the folder does not exist)
這些都是地方git gc documentation列出可以包含引用。
仍然給定的提交在git gc
之後仍然存在。
我錯過了什麼嗎?或者是否有任何git plumbing命令檢查所有這些引用?
非常好,丟失的是重新包裝。如果包裝有可訪問的對象,則即使無法訪問的對象也不會被丟棄。所以'repack'將它們分開,然後'git prune'或'git gc'將正確處理它們。 – LopSae 2013-02-21 19:52:53
即使使用'git prune',我的倉庫仍然有鬆散的對象。如果你遇到這種情況,'git gc' doc文件表明它非常難*保證安全並保留任何可能的引用。確保清理你的.git文件夾中的/ refs,/ logs,FETCH_HEAD和其他緩存。然後重新運行'git gc --prune = now'就可以了。 – jsgoupil 2014-05-28 19:05:55