path: root/Documentation/git-gc.txt
diff options
authorNguyễn Thái Ngọc Duy <>2018-04-15 15:36:14 (GMT)
committerJunio C Hamano <>2018-04-16 04:52:29 (GMT)
commitae4e89e549b76b561a1c384dd7314c9b671c22bc (patch)
tree60df0a8ae7e4eaa21e2f9c815bc7fd96cb1d6efa /Documentation/git-gc.txt
parented7e5fc3a2562e3d4fb4fe25e8dca0e9daa0ed13 (diff)
gc: add --keep-largest-pack option
This adds a new repack mode that combines everything into a secondary pack, leaving the largest pack alone. This could help reduce memory pressure. On linux-2.6.git, valgrind massif reports 1.6GB heap in "pack all" case, and 535MB in "pack all except the base pack" case. We save roughly 1GB memory by excluding the base pack. This should also lower I/O because we don't have to rewrite a giant pack every time (e.g. for linux-2.6.git that's a 1.4GB pack file).. PS. The use of string_list here seems overkill, but we'll need it in the next patch... Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/git-gc.txt')
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 3126e0d..8f90323 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]
@@ -84,6 +84,10 @@ 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.