为什么这个 Git 提交垃圾没有被收集?

Why isn't this Git commit garbage collected?

我找到了一个不在任何分支上的提交(使用 git log --all)。

$ git show ffeb1787af33993ee9658f42337f2688013cbcb8
commit ffeb1787af33993ee9658f42337f2688013cbcb8
...
$ git branch --contains ffeb1787af33993ee9658f42337f2688013cbcb8

git gc 等之后它仍然存在。

它必须被其他一些引用保留,例如标签。

我如何找到此提交仍在我的存储库中的原因?

试试这个:

git name-rev ffeb1787af33993ee9658f42337f2688013cbcb8

它将尝试根据它所在的链(如果有的话)计算该 SHA 的符号名称。