Skip to content

Commit 22d4e3b

Browse files
avargitster
authored andcommitted
gc docs: downplay the usefulness of --aggressive
The existing "gc --aggressive" docs come just short of recommending to users that they run it regularly. I've personally talked to many users who've taken these docs as an advice to use this option, and have, usually it's (mostly) a waste of time. So let's clarify what it really does, and let the user draw their own conclusions. Let's also clarify the "The effects [...] are persistent" to paraphrase a brief version of Jeff King's explanation at [1]. 1. https://public-inbox.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 080a448 commit 22d4e3b

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

Documentation/git-gc.txt

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ OPTIONS
3939
space utilization and performance. This option will cause
4040
'git gc' to more aggressively optimize the repository at the expense
4141
of taking much more time. The effects of this optimization are
42-
persistent, so this option only needs to be used occasionally; every
43-
few hundred changesets or so.
42+
mostly persistent. See the "AGGRESSIVE" section below for details.
4443

4544
--auto::
4645
With this option, 'git gc' checks whether any housekeeping is
@@ -78,6 +77,32 @@ be performed as well.
7877
`.keep` files are consolidated into a single pack. When this
7978
option is used, `gc.bigPackThreshold` is ignored.
8079

80+
AGGRESSIVE
81+
----------
82+
83+
When the `--aggressive` option is supplied, linkgit:git-repack[1] will
84+
be invoked with the `-f` flag, which in turn will pass
85+
`--no-reuse-delta` to linkgit:git-pack-objects[1]. This will throw
86+
away any existing deltas and re-compute them, at the expense of
87+
spending much more time on the repacking.
88+
89+
The effects of this are mostly persistent, e.g. when packs and loose
90+
objects are coalesced into one another pack the existing deltas in
91+
that pack might get re-used, but there are also various cases where we
92+
might pick a sub-optimal delta from a newer pack instead.
93+
94+
Furthermore, supplying `--aggressive` will tweak the `--depth` and
95+
`--window` options passed to linkgit:git-repack[1]. See the
96+
`gc.aggressiveDepth` and `gc.aggressiveWindow` settings below. By
97+
using a larger window size we're more likely to find more optimal
98+
deltas.
99+
100+
It's probably not worth it to use this option on a given repository
101+
without running tailored performance benchmarks on it. It takes a lot
102+
more time, and the resulting space/delta optimization may or may not
103+
be worth it. Not using this at all is the right trade-off for most
104+
users and their repositories.
105+
81106
CONFIGURATION
82107
-------------
83108

0 commit comments

Comments
 (0)