SYNOPSIS
git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]
DESCRIPTION
Runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance) and removing unreachable objects which may have been created from prior invocations of git add.
Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.
Some git commands may automatically run git gc; see the --auto flag
below for details. If you know what you’re doing and all you want is to
disable this behavior permanently without further considerations, just do:
$ git config --global gc.auto 0
OPTIONS
- --aggressive
-
Usually git gc runs very quickly while providing good disk space utilization and performance. This option will cause git gc to more aggressively optimize the repository at the expense of taking much more time. The effects of this optimization are persistent, so this option only needs to be used occasionally; every few hundred changesets or so.
- --auto
-
With this option, git gc checks whether any housekeeping is required; if not, it exits without performing any work. Some git commands run
git gc --autoafter performing operations that could create many loose objects.Housekeeping is required if there are too many loose objects or too many packs in the repository. If the number of loose objects exceeds the value of the
gc.autoconfiguration variable, then all loose objects are combined into a single pack usinggit repack -d -l. Setting the value ofgc.autoto 0 disables automatic packing of loose objects.If the number of packs exceeds the value of
gc.autopacklimit, then existing packs (except those marked with a.keepfile) are consolidated into a single pack by using the-Aoption of git repack. Settinggc.autopacklimitto 0 disables automatic consolidation of packs. - --prune=<date>
-
Prune loose objects older than date (default is 2 weeks ago, overridable by the config variable
gc.pruneExpire). This option is on by default. - --no-prune
-
Do not prune any loose objects.
- --quiet
-
Suppress all progress reports.
Configuration
The optional configuration variable gc.reflogExpire can be set to indicate how long historical entries within each branch’s reflog should remain available in this repository. The setting is expressed as a length of time, for example 90 days or 3 months. It defaults to 90 days.
The optional configuration variable gc.ref