2

git isn't a server-client architecture, so there is no git server. I read somewhere that git prunes reflog (& other garbage collection) in 90 days. Now there is no server that checks for the last reflog entry & waits for 90 days to do GC. So how does it work? Who schedules background git pruning?

Kamal Banga
  • 181
  • 1
  • 6

1 Answers1

2

git gc ends up being run automatically during the normal use of a repo.

For example, in "Do I ever need to run git gc on a bare repo?", Jefromi mentions:

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.

So if you are doing anything with the repo (clone/push/pull), git gc will run and checks with its internal reflog if 90 days are reached or not.

It is a local operation to the repo, with a local reflog, and it doesn't need a server at all.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250