The `git gc` function is used to perform housekeeping in a Git repository, run automatically by certain other Git operations, or manually.
General information
This function performs a number of housekeeping operations on a Git repository, including compressing file revisions and removing unreachable objects.
There are three main modes of operation:
- Automatic. Certain Git commands will run - git gc --auto, which will attempt to determine whether clean-up is necessary, and perform it if so. Automatic housekeeping can be disabled by running- git config gc.auto 0.
- Manual. You can run - git gcfrom the command line whenever you like. This is particularly important if you've disabled the automatic operation as above.
- Aggressive. Running - git gc --aggressivewill perform a much slower and more thorough optimization. The Git man pages recommend doing this only "every few hundred changesets or so", since the effects are persistent.
See also the Git man page for git gc.
On Stack Overflow
The "git-gc" tag should be used for anything to do with this command: when to run it, how to run it, how to resolve problems with running it or caused by running it, and how to configure how it works.
 
     
     
     
     
     
     
     
     
     
     
     
     
    