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
11

DESCRIPTION

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

OPTIONS

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

CONFIGURATION

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

NOTES

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

HOOKS

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

SEE ALSO

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

GIT

137       Part of the git(1) suite
138
139
140
141Git 1.8.3.1                       11/19/2018                         GIT-GC(1)
Impressum