83843a549cb3ad89d15e18fcfe22ce74dbb0a81e
   1git-gc(1)
   2=========
   3
   4NAME
   5----
   6git-gc - Cleanup unnecessary files and optimize the local repository
   7
   8
   9SYNOPSIS
  10--------
  11'git-gc' [--prune] [--aggressive] [--auto]
  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 gitlink: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--prune::
  29        Usually `git-gc` packs refs, expires old reflog entries,
  30        packs loose objects,
  31        and removes old 'rerere' records.  Removal
  32        of unreferenced loose objects is an unsafe operation
  33        while other git operations are in progress, so it is not
  34        done by default.  Pass this option if you want it, and only
  35        when you know nobody else is creating new objects in the
  36        repository at the same time (e.g. never use this option
  37        in a cron script).
  38
  39--aggressive::
  40        Usually 'git-gc' runs very quickly while providing good disk
  41        space utilization and performance.  This option will cause
  42        git-gc to more aggressively optimize the repository at the expense
  43        of taking much more time.  The effects of this optimization are
  44        persistent, so this option only needs to be used occasionally; every
  45        few hundred changesets or so.
  46
  47--auto::
  48        With this option, `git gc` checks if there are too many
  49        loose objects in the repository and runs
  50        gitlink:git-repack[1] with `-d -l` option to pack them.
  51        The threshold for loose objects is set with `gc.auto` configuration
  52        variable, and can be disabled by setting it to 0.  Some
  53        Porcelain commands use this after they perform operation
  54        that could create many loose objects automatically.
  55        Additionally, when there are too many packs are present,
  56        they are consolidated into one larger pack by running
  57        the `git-repack` command with `-A` option.  The
  58        threshold for number of packs is set with
  59        `gc.autopacklimit` configuration variable.
  60
  61Configuration
  62-------------
  63
  64The optional configuration variable 'gc.reflogExpire' can be
  65set to indicate how long historical entries within each branch's
  66reflog should remain available in this repository.  The setting is
  67expressed as a length of time, for example '90 days' or '3 months'.
  68It defaults to '90 days'.
  69
  70The optional configuration variable 'gc.reflogExpireUnreachable'
  71can be set to indicate how long historical reflog entries which
  72are not part of the current branch should remain available in
  73this repository.  These types of entries are generally created as
  74a result of using `git commit \--amend` or `git rebase` and are the
  75commits prior to the amend or rebase occurring.  Since these changes
  76are not part of the current project most users will want to expire
  77them sooner.  This option defaults to '30 days'.
  78
  79The optional configuration variable 'gc.rerereresolved' indicates
  80how long records of conflicted merge you resolved earlier are
  81kept.  This defaults to 60 days.
  82
  83The optional configuration variable 'gc.rerereunresolved' indicates
  84how long records of conflicted merge you have not resolved are
  85kept.  This defaults to 15 days.
  86
  87The optional configuration variable 'gc.packrefs' determines if
  88`git gc` runs `git-pack-refs`.  Without the configuration, `git-pack-refs`
  89is not run in bare repositories by default, to allow older dumb-transport
  90clients fetch from the repository,  but this will change in the future.
  91
  92The optional configuration variable 'gc.aggressiveWindow' controls how
  93much time is spent optimizing the delta compression of the objects in
  94the repository when the --aggressive option is specified.  The larger
  95the value, the more time is spent optimizing the delta compression.  See
  96the documentation for the --window' option in gitlink:git-repack[1] for
  97more details.  This defaults to 10.
  98
  99See Also
 100--------
 101gitlink:git-prune[1]
 102gitlink:git-reflog[1]
 103gitlink:git-repack[1]
 104gitlink:git-rerere[1]
 105
 106Author
 107------
 108Written by Shawn O. Pearce <spearce@spearce.org>
 109
 110GIT
 111---
 112Part of the gitlink:git[7] suite