没有git服务器时,git如何进行GC?

How does git do GC when there is no git server?

git 不是服务器-客户端架构,因此没有 git 服务器。 我在某处读到 git 在 90 天内修剪 reflog(和其他垃圾收集)。现在没有服务器检查最后一个 reflog 条目并等待 90 天来执行 GC。那么它是怎样工作的?谁安排后台 git 修剪?

git gc 在正常使用 repo 期间自动成为 运行。

例如,在“Do I ever need to run git gc on a bare repo?", Jefromi 中提到:

It's also true that enough commands run it automatically that you essentially never have to.
In the case of a bare repo, it's receive-pack that invokes gc --auto.

因此,如果您正在对回购 (clone/push/pull) 进行任何操作,git gc 将 运行 并检查其内部 reflog 是否达到 90 天。

它是对 repo 的本地操作,带有本地 reflog,根本不需要服务器。