gc.txt: more details about what gc does
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 15, 2018 at 17:44 UTC
b586a96a399be78fa49a95682e52ff96c9e5ca3f
1 file changed
+19
-9
Documentation/git-gc.txt
+19
-9
@@ -15,8 +15,9 @@ DESCRIPTION
15
-----------
16
Runs a number of housekeeping tasks within the current repository,
17
such as compressing file revisions (to reduce disk space and increase
18
-performance) and removing unreachable objects which may have been
19
-created from prior invocations of 'git add'.
18
+performance), removing unreachable objects which may have been
19
+created from prior invocations of 'git add', packing refs, pruning
20
+reflog, rerere metadata or stale working trees.
21
22
Users are encouraged to run this task on a regular basis within
23
each repository to maintain good disk space utilization and good
@@ -45,20 +46,25 @@ OPTIONS
46
With this option, 'git gc' checks whether any housekeeping is
47
required; if not, it exits without performing any work.
48
Some git commands run `git gc --auto` after performing
48
- operations that could create many loose objects.
49
+ operations that could create many loose objects. Housekeeping
50
+ is required if there are too many loose objects or too many
51
+ packs in the repository.
52
+
50
-Housekeeping is required if there are too many loose objects or
51
-too many packs in the repository. If the number of loose objects
52
-exceeds the value of the `gc.auto` configuration variable, then
53
-all loose objects are combined into a single pack using
54
-`git repack -d -l`. Setting the value of `gc.auto` to 0
55
-disables automatic packing of loose objects.
53
+If the number of loose objects exceeds the value of the `gc.auto`
54
+configuration variable, then all loose objects are combined into a
55
+single pack using `git repack -d -l`. Setting the value of `gc.auto`
56
+to 0 disables automatic packing of loose objects.
57
+
58
If the number of packs exceeds the value of `gc.autoPackLimit`,
59
then existing packs (except those marked with a `.keep` file)
60
are consolidated into a single pack by using the `-A` option of
61
'git repack'. Setting `gc.autoPackLimit` to 0 disables
62
automatic consolidation of packs.
63
++
64
+If houskeeping is required due to many loose objects or packs, all
65
+other housekeeping tasks (e.g. rerere, working trees, reflog...) will
66
+be performed as well.
67
+
68
69
--prune=<date>::
70
Prune loose objects older than date (default is 2 weeks ago,
@@ -133,6 +139,10 @@ The optional configuration variable `gc.pruneExpire` controls how old
139
the unreferenced loose objects have to be before they are pruned. The
140
default is "2 weeks ago".
141
142
+Optional configuration variable `gc.worktreePruneExpire` controls how
143
+old a stale working tree should be before `git worktree prune` deletes
144
+it. Default is "3 months ago".
145
+
146
147
Notes
148
-----