]>
Commit | Line | Data |
---|---|---|
30f610b7 SP |
1 | git-gc(1) |
2 | ========= | |
3 | ||
4 | NAME | |
5 | ---- | |
6 | git-gc - Cleanup unnecessary files and optimize the local repository | |
7 | ||
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
0d7566a5 | 11 | 'git-gc' [--prune] [--aggressive] |
30f610b7 SP |
12 | |
13 | DESCRIPTION | |
14 | ----------- | |
15 | Runs a number of housekeeping tasks within the current repository, | |
16 | such as compressing file revisions (to reduce disk space and increase | |
17 | performance) and removing unreachable objects which may have been | |
18 | created from prior invocations of gitlink:git-add[1]. | |
19 | ||
20 | Users are encouraged to run this task on a regular basis within | |
21 | each repository to maintain good disk space utilization and good | |
22 | operating performance. | |
23 | ||
e3ff4b24 JH |
24 | OPTIONS |
25 | ------- | |
26 | ||
27 | --prune:: | |
28 | Usually `git-gc` packs refs, expires old reflog entries, | |
29 | packs loose objects, | |
30 | and removes old 'rerere' records. Removal | |
31 | of unreferenced loose objects is an unsafe operation | |
32 | while other git operations are in progress, so it is not | |
33 | done by default. Pass this option if you want it, and only | |
34 | when you know nobody else is creating new objects in the | |
35 | repository at the same time (e.g. never use this option | |
36 | in a cron script). | |
37 | ||
0d7566a5 TT |
38 | --aggressive:: |
39 | Usually 'git-gc' runs very quickly while providing good disk | |
40 | space utilization and performance. This option will cause | |
41 | git-gc to more aggressive optimize the repository at the expense | |
42 | of taking much more time. The effects of this optimization are | |
43 | persistent, so this option only needs to be sporadically; every | |
44 | few hundred changesets or so. | |
e3ff4b24 | 45 | |
30f610b7 SP |
46 | Configuration |
47 | ------------- | |
48 | ||
49 | The optional configuration variable 'gc.reflogExpire' can be | |
50 | set to indicate how long historical entries within each branch's | |
51 | reflog should remain available in this repository. The setting is | |
52 | expressed as a length of time, for example '90 days' or '3 months'. | |
53 | It defaults to '90 days'. | |
54 | ||
55 | The optional configuration variable 'gc.reflogExpireUnreachable' | |
56 | can be set to indicate how long historical reflog entries which | |
57 | are not part of the current branch should remain available in | |
58 | this repository. These types of entries are generally created as | |
59 | a result of using `git commit \--amend` or `git rebase` and are the | |
23bfbb81 | 60 | commits prior to the amend or rebase occurring. Since these changes |
30f610b7 SP |
61 | are not part of the current project most users will want to expire |
62 | them sooner. This option defaults to '30 days'. | |
63 | ||
64 | The optional configuration variable 'gc.rerereresolved' indicates | |
65 | how long records of conflicted merge you resolved earlier are | |
66 | kept. This defaults to 60 days. | |
67 | ||
68 | The optional configuration variable 'gc.rerereunresolved' indicates | |
69 | how long records of conflicted merge you have not resolved are | |
70 | kept. This defaults to 15 days. | |
71 | ||
c2120e5e JS |
72 | The optional configuration variable 'gc.packrefs' determines if |
73 | `git gc` runs `git-pack-refs`. Without the configuration, `git-pack-refs` | |
74 | is not run in bare repositories by default, to allow older dumb-transport | |
75 | clients fetch from the repository, but this will change in the future. | |
30f610b7 | 76 | |
0d7566a5 TT |
77 | The optional configuration variable 'gc.aggressiveWindow' controls how |
78 | much time is spent optimizing the delta compression of the objects in | |
79 | the repository when the --aggressive option is specified. The larger | |
80 | the value, the more time is spent optimizing the delta compression. See | |
81 | the documentation for the --window' option in gitlink:git-repack[1] for | |
82 | more details. This defaults to 10. | |
83 | ||
30f610b7 SP |
84 | See Also |
85 | -------- | |
86 | gitlink:git-prune[1] | |
87 | gitlink:git-reflog[1] | |
88 | gitlink:git-repack[1] | |
89 | gitlink:git-rerere[1] | |
90 | ||
91 | Author | |
92 | ------ | |
93 | Written by Shawn O. Pearce <spearce@spearce.org> | |
94 | ||
95 | GIT | |
96 | --- | |
97 | Part of the gitlink:git[7] suite |