12

I've been reading up on git, and I have a very particular question I am struggling to answer.

When does git gc execute autonomously?

I've been hearing through the grape-vine of various forums that it occurs by default on a push or a fetch/pull - but I cannot find any source that verifies this. Even the documentation itself only gets this specific (emphasis mine):

Some git commands may automatically run git gc; see the --auto flag below for details

and the --auto flag specifies

Some git commands run git gc --auto after performing operations that could create many loose objects.

I want to be able to deterministically say:

"Loose tree and blob files will not have been cleaned up by git until one of the following commands is run: {mystery list here}. When running one of these commands, if the number of loose objects exceeds the value of gc.auto, git will automatically compress the objects into a packfile".

Matt
  • 1,674
  • 2
  • 16
  • 34

1 Answers1

8

Currently those are:

Actual list can be verified by doing a code search.

Also from that you can see that gc on receive can be disabled with receive.autogc, others just run the gc in the end.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Ivan
  • 3,781
  • 16
  • 20