1GIT-GC(1)                         Git Manual                         GIT-GC(1)
2
3
4

NAME

6       git-gc - Cleanup unnecessary files and optimize the local repository
7

SYNOPSIS

9       git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]
10

DESCRIPTION

12       Runs a number of housekeeping tasks within the current repository, such
13       as compressing file revisions (to reduce disk space and increase
14       performance) and removing unreachable objects which may have been
15       created from prior invocations of git add.
16
17       Users are encouraged to run this task on a regular basis within each
18       repository to maintain good disk space utilization and good operating
19       performance.
20
21       Some git commands may automatically run git gc; see the --auto flag
22       below for details. If you know what you’re doing and all you want is to
23       disable this behavior permanently without further considerations, just
24       do:
25
26           $ git config --global gc.auto 0
27
28

OPTIONS

30       --aggressive
31           Usually git gc runs very quickly while providing good disk space
32           utilization and performance. This option will cause git gc to more
33           aggressively optimize the repository at the expense of taking much
34           more time. The effects of this optimization are persistent, so this
35           option only needs to be used occasionally; every few hundred
36           changesets or so.
37
38       --auto
39           With this option, git gc checks whether any housekeeping is
40           required; if not, it exits without performing any work. Some git
41           commands run git gc --auto after performing operations that could
42           create many loose objects.
43
44           Housekeeping is required if there are too many loose objects or too
45           many packs in the repository. If the number of loose objects
46           exceeds the value of the gc.auto configuration variable, then all
47           loose objects are combined into a single pack using git repack -d
48           -l. Setting the value of gc.auto to 0 disables automatic packing of
49           loose objects.
50
51           If the number of packs exceeds the value of gc.autopacklimit, then
52           existing packs (except those marked with a .keep file) are
53           consolidated into a single pack by using the -A option of git
54           repack. Setting gc.autopacklimit to 0 disables automatic
55           consolidation of packs.
56
57       --prune=<date>
58           Prune loose objects older than date (default is 2 weeks ago,
59           overridable by the config variable gc.pruneExpire). This option is
60           on by default.
61
62       --no-prune
63           Do not prune any loose objects.
64
65       --quiet
66           Suppress all progress reports.
67

CONFIGURATION

69       The optional configuration variable gc.reflogExpire can be set to
70       indicate how long historical entries within each branch’s reflog should
71       remain available in this repository. The setting is expressed as a
72       length of time, for example 90 days or 3 months. It defaults to 90
73       days.
74
75       The optional configuration variable gc.reflogExpireUnreachable can be
76       set to indicate how long historical reflog entries which are not part
77       of the current branch should remain available in this repository. These
78       types of entries are generally created as a result of using git commit
79       --amend or git rebase and are the commits prior to the amend or rebase
80       occurring. Since these changes are not part of the current project most
81       users will want to expire them sooner. This option defaults to 30 days.
82
83       The above two configuration variables can be given to a pattern. For
84       example, this sets non-default expiry values only to remote-tracking
85       branches:
86
87           [gc "refs/remotes/*"]
88                   reflogExpire = never
89                   reflogexpireUnreachable = 3 days
90
91
92       The optional configuration variable gc.rerereresolved indicates how
93       long records of conflicted merge you resolved earlier are kept. This
94       defaults to 60 days.
95
96       The optional configuration variable gc.rerereunresolved indicates how
97       long records of conflicted merge you have not resolved are kept. This
98       defaults to 15 days.
99
100       The optional configuration variable gc.packrefs determines if git gc
101       runs git pack-refs. This can be set to "notbare" to enable it within
102       all non-bare repos or it can be set to a boolean value. This defaults
103       to true.
104
105       The optional configuration variable gc.aggressiveWindow controls how
106       much time is spent optimizing the delta compression of the objects in
107       the repository when the --aggressive option is specified. The larger
108       the value, the more time is spent optimizing the delta compression. See
109       the documentation for the --window' option in git-repack(1) for more
110       details. This defaults to 250.
111
112       The optional configuration variable gc.pruneExpire controls how old the
113       unreferenced loose objects have to be before they are pruned. The
114       default is "2 weeks ago".
115

NOTES

117       git gc tries very hard to be safe about the garbage it collects. In
118       particular, it will keep not only objects referenced by your current
119       set of branches and tags, but also objects referenced by the index,
120       remote-tracking branches, refs saved by git filter-branch in
121       refs/original/, or reflogs (which may reference commits in branches
122       that were later amended or rewound).
123
124       If you are expecting some objects to be collected and they aren’t,
125       check all of those locations and decide whether it makes sense in your
126       case to remove those references.
127

HOOKS

129       The git gc --auto command will run the pre-auto-gc hook. See
130       githooks(5) for more information.
131

SEE ALSO

133       git-prune(1) git-reflog(1) git-repack(1) git-rerere(1)
134

AUTHOR

136       Written by Shawn O. Pearce <spearce@spearce.org[1]>
137

GIT

139       Part of the git(1) suite
140

NOTES

142        1. spearce@spearce.org
143           mailto:spearce@spearce.org
144
145
146
147Git 1.7.4.4                       04/11/2011                         GIT-GC(1)
Impressum