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 optional configuration variable gc.rerereresolved indicates how
84       long records of conflicted merge you resolved earlier are kept. This
85       defaults to 60 days.
86
87       The optional configuration variable gc.rerereunresolved indicates how
88       long records of conflicted merge you have not resolved are kept. This
89       defaults to 15 days.
90
91       The optional configuration variable gc.packrefs determines if git gc
92       runs git pack-refs. This can be set to "nobare" to enable it within all
93       non-bare repos or it can be set to a boolean value. This defaults to
94       true.
95
96       The optional configuration variable gc.aggressiveWindow controls how
97       much time is spent optimizing the delta compression of the objects in
98       the repository when the --aggressive option is specified. The larger
99       the value, the more time is spent optimizing the delta compression. See
100       the documentation for the --window´ option in git-repack(1) for more
101       details. This defaults to 250.
102
103       The optional configuration variable gc.pruneExpire controls how old the
104       unreferenced loose objects have to be before they are pruned. The
105       default is "2 weeks ago".
106

NOTES

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

SEE ALSO

120       git-prune(1) git-reflog(1) git-repack(1) git-rerere(1)
121

AUTHOR

123       Written by Shawn O. Pearce <spearce@spearce.org[1]>
124

GIT

126       Part of the git(1) suite
127

NOTES

129        1. spearce@spearce.org
130           mailto:spearce@spearce.org
131
132
133
134Git 1.7.1                         08/16/2017                         GIT-GC(1)
Impressum