Documentation / git-gc.txton commit Fix read-tree not to discard errors (c4758d3)
   1git-gc(1)
   2=========
   3
   4NAME
   5----
   6git-gc - Cleanup unnecessary files and optimize the local repository
   7
   8
   9SYNOPSIS
  10--------
  11'git-gc' [--aggressive] [--auto] [--quiet]
  12
  13DESCRIPTION
  14-----------
  15Runs a number of housekeeping tasks within the current repository,
  16such as compressing file revisions (to reduce disk space and increase
  17performance) and removing unreachable objects which may have been
  18created from prior invocations of linkgit:git-add[1].
  19
  20Users are encouraged to run this task on a regular basis within
  21each repository to maintain good disk space utilization and good
  22operating performance. Some git commands may automatically run
  23`git-gc`; see the `--auto` flag below for details.
  24
  25OPTIONS
  26-------
  27
  28--aggressive::
  29        Usually 'git-gc' runs very quickly while providing good disk
  30        space utilization and performance.  This option will cause
  31        git-gc to more aggressively optimize the repository at the expense
  32        of taking much more time.  The effects of this optimization are
  33        persistent, so this option only needs to be used occasionally; every
  34        few hundred changesets or so.
  35
  36--auto::
  37        With this option, `git gc` checks whether any housekeeping is
  38        required; if not, it exits without performing any work.
  39        Some git commands run `git gc --auto` after performing
  40        operations that could create many loose objects.
  41+
  42Housekeeping is required if there are too many loose objects or
  43too many packs in the repository. If the number of loose objects
  44exceeds the value of the `gc.auto` configuration variable, then
  45all loose objects are combined into a single pack using
  46`git-repack -d -l`.  Setting the value of `gc.auto` to 0
  47disables automatic packing of loose objects.
  48+
  49If the number of packs exceeds the value of `gc.autopacklimit`,
  50then existing packs (except those marked with a `.keep` file)
  51are consolidated into a single pack by using the `-A` option of
  52`git-repack`. Setting `gc.autopacklimit` to 0 disables
  53automatic consolidation of packs.
  54
  55--quiet::
  56        Suppress all progress reports.
  57
  58Configuration
  59-------------
  60
  61The optional configuration variable 'gc.reflogExpire' can be
  62set to indicate how long historical entries within each branch's
  63reflog should remain available in this repository.  The setting is
  64expressed as a length of time, for example '90 days' or '3 months'.
  65It defaults to '90 days'.
  66
  67The optional configuration variable 'gc.reflogExpireUnreachable'
  68can be set to indicate how long historical reflog entries which
  69are not part of the current branch should remain available in
  70this repository.  These types of entries are generally created as
  71a result of using `git commit \--amend` or `git rebase` and are the
  72commits prior to the amend or rebase occurring.  Since these changes
  73are not part of the current project most users will want to expire
  74them sooner.  This option defaults to '30 days'.
  75
  76The optional configuration variable 'gc.rerereresolved' indicates
  77how long records of conflicted merge you resolved earlier are
  78kept.  This defaults to 60 days.
  79
  80The optional configuration variable 'gc.rerereunresolved' indicates
  81how long records of conflicted merge you have not resolved are
  82kept.  This defaults to 15 days.
  83
  84The optional configuration variable 'gc.packrefs' determines if
  85`git gc` runs `git-pack-refs`. This can be set to "nobare" to enable
  86it within all non-bare repos or it can be set to a boolean value.
  87This defaults to true.
  88
  89The optional configuration variable 'gc.aggressiveWindow' controls how
  90much time is spent optimizing the delta compression of the objects in
  91the repository when the --aggressive option is specified.  The larger
  92the value, the more time is spent optimizing the delta compression.  See
  93the documentation for the --window' option in linkgit:git-repack[1] for
  94more details.  This defaults to 10.
  95
  96The optional configuration variable 'gc.pruneExpire' controls how old
  97the unreferenced loose objects have to be before they are pruned.  The
  98default is "2 weeks ago".
  99
 100See Also
 101--------
 102linkgit:git-prune[1]
 103linkgit:git-reflog[1]
 104linkgit:git-repack[1]
 105linkgit:git-rerere[1]
 106
 107Author
 108------
 109Written by Shawn O. Pearce <spearce@spearce.org>
 110
 111GIT
 112---
 113Part of the linkgit:git[7] suite