path: root/Documentation/git-gc.txt
diff options
authorJunio C Hamano <>2018-05-23 05:38:14 (GMT)
committerJunio C Hamano <>2018-05-23 05:38:14 (GMT)
commit30b015bffe21a127d4f349f9e876562c3c94a1a2 (patch)
tree665d489fdc6cbef1a1dd9ed2dfa1f75afb717a35 /Documentation/git-gc.txt
parentc89b6e136e421f1e9108b3c5bc050b19b0243844 (diff)
parent5af050437af1c061804b4317154085c65490bbac (diff)
Merge branch 'nd/repack-keep-pack'
"git gc" in a large repository takes a lot of time as it considers to repack all objects into one pack by default. The command has been taught to pretend as if the largest existing packfile is marked with ".keep" so that it is left untouched while objects in other packs and loose ones are repacked. * nd/repack-keep-pack: pack-objects: show some progress when counting kept objects gc --auto: exclude base pack if not enough mem to "repack -ad" gc: handle a corner case in gc.bigPackThreshold gc: add gc.bigPackThreshold config gc: add --keep-largest-pack option repack: add --keep-pack option t7700: have closing quote of a test at the beginning of line
Diffstat (limited to 'Documentation/git-gc.txt')
1 files changed, 15 insertions, 4 deletions
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 7c8a2ed..bb376ac 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
-'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force]
+'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]
@@ -56,10 +56,16 @@ single pack using `git repack -d -l`. Setting the value of ``
to 0 disables automatic packing of loose objects.
If the number of packs exceeds the value of `gc.autoPackLimit`,
-then existing packs (except those marked with a `.keep` file)
+then existing packs (except those marked with a `.keep` file
+or over `gc.bigPackThreshold` limit)
are consolidated into a single pack by using the `-A` option of
-'git repack'. Setting `gc.autoPackLimit` to 0 disables
-automatic consolidation of packs.
+'git repack'.
+If the amount of memory is estimated not enough for `git repack` to
+run smoothly and `gc.bigPackThreshold` is not set, the largest
+pack will also be excluded (this is the equivalent of running `git gc`
+with `--keep-base-pack`).
+Setting `gc.autoPackLimit` to 0 disables automatic consolidation of
If houskeeping is required due to many loose objects or packs, all
other housekeeping tasks (e.g. rerere, working trees, reflog...) will
@@ -84,6 +90,11 @@ be performed as well.
Force `git gc` to run even if there may be another `git gc`
instance running on this repository.
+ All packs except the largest pack and those marked with a
+ `.keep` files are consolidated into a single pack. When this
+ option is used, `gc.bigPackThreshold` is ignored.