@@ -15,8 +15,9 @@ DESCRIPTION
1515-----------
1616Runs a number of housekeeping tasks within the current repository,
1717such 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.
2021
2122Users are encouraged to run this task on a regular basis within
2223each repository to maintain good disk space utilization and good
@@ -45,20 +46,25 @@ OPTIONS
4546 With this option, 'git gc' checks whether any housekeeping is
4647 required; if not, it exits without performing any work.
4748 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.
4952+
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.
5657+
5758If the number of packs exceeds the value of `gc.autoPackLimit`,
5859then existing packs (except those marked with a `.keep` file)
5960are consolidated into a single pack by using the `-A` option of
6061'git repack'. Setting `gc.autoPackLimit` to 0 disables
6162automatic 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+
6268
6369--prune=<date>::
6470 Prune loose objects older than date (default is 2 weeks ago,
@@ -133,6 +139,10 @@ The optional configuration variable `gc.pruneExpire` controls how old
133139the unreferenced loose objects have to be before they are pruned. The
134140default is "2 weeks ago".
135141
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+
136146
137147Notes
138148-----
0 commit comments