blob: ae750e9e1149f512dd5889a8081452055ccdb6d7 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-repack(1)
2=============
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-repack - Pack unpacked objects in a repository
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamano6b6144f2017-05-29 06:20:1512'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>]
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
16
Junio C Hamano79a784d2013-10-28 19:15:4317This command is used to combine all objects that do not currently
Junio C Hamanoa6387422007-08-25 03:54:2718reside in a "pack", into a pack. It can also be used to re-organize
Junio C Hamano401939f2007-07-01 06:34:3019existing packs into a single, more efficient pack.
Junio C Hamano1a4e8412005-12-27 08:17:2320
21A pack is a collection of objects, individually compressed, with
22delta compression applied, stored in a single file, with an
23associated index file.
24
25Packs are used to reduce the load on mirror systems, backup
26engines, disk storage, etc.
27
28OPTIONS
29-------
30
31-a::
32Instead of incrementally packing the unpacked objects,
Junio C Hamano401939f2007-07-01 06:34:3033pack everything referenced into a single pack.
Junio C Hamano1a4e8412005-12-27 08:17:2334Especially useful when packing a repository that is used
Junio C Hamano4d81e522009-06-10 08:08:5135for private development. Use
Junio C Hamano92d80372016-07-13 22:00:0536with `-d`. This will clean up the objects that `git prune`
Junio C Hamano81d540a2012-03-02 19:52:4737leaves behind, but `git fsck --full --dangling` shows as
Junio C Hamano401939f2007-07-01 06:34:3038dangling.
Junio C Hamano4d81e522009-06-10 08:08:5139+
40Note that users fetching over dumb protocols will have to fetch the
41whole new pack in order to get any contained object, no matter how many
42other objects in that pack they already have locally.
Junio C Hamano1a4e8412005-12-27 08:17:2343
Junio C Hamanob713ff12008-05-24 01:12:3044-A::
Junio C Hamano92d80372016-07-13 22:00:0545Same as `-a`, unless `-d` is used. Then any unreachable
Junio C Hamanobba37ad2008-11-16 17:47:5946objects in a previous pack become loose, unpacked objects,
47instead of being left in the old pack. Unreachable objects
48are never intentionally added to a pack, even when repacking.
49This option prevents unreachable objects from being immediately
Junio C Hamanob713ff12008-05-24 01:12:3050deleted by way of being left in the old pack and then
51removed. Instead, the loose unreachable objects
52will be pruned according to normal expiry rules
Junio C Hamano1aa40d22010-01-21 17:46:4353with the next 'git gc' invocation. See linkgit:git-gc[1].
Junio C Hamanob713ff12008-05-24 01:12:3054
Junio C Hamano1a4e8412005-12-27 08:17:2355-d::
56After packing, if the newly created packs make some
57existing packs redundant, remove the redundant packs.
Junio C Hamano1aa40d22010-01-21 17:46:4358Also run 'git prune-packed' to remove redundant
Junio C Hamanofce7c7e2008-07-02 03:06:3859loose object files.
Junio C Hamano1a4e8412005-12-27 08:17:2360
61-l::
Junio C Hamano1aa40d22010-01-21 17:46:4362Pass the `--local` option to 'git pack-objects'. See
Junio C Hamano35738e82008-01-07 07:55:4663linkgit:git-pack-objects[1].
Junio C Hamano1a4e8412005-12-27 08:17:2364
Junio C Hamano7e9f6b72006-02-22 10:44:5565-f::
Junio C Hamano657fd8a2010-10-07 00:01:2466Pass the `--no-reuse-delta` option to `git-pack-objects`, see
67linkgit:git-pack-objects[1].
68
69-F::
Junio C Hamano7cc91292008-09-20 16:55:3870Pass the `--no-reuse-object` option to `git-pack-objects`, see
Junio C Hamano35738e82008-01-07 07:55:4671linkgit:git-pack-objects[1].
Junio C Hamano7e9f6b72006-02-22 10:44:5572
73-q::
Junio C Hamano1aa40d22010-01-21 17:46:4374Pass the `-q` option to 'git pack-objects'. See
Junio C Hamano35738e82008-01-07 07:55:4675linkgit:git-pack-objects[1].
Junio C Hamano7e9f6b72006-02-22 10:44:5576
Junio C Hamano1a4e8412005-12-27 08:17:2377-n::
Junio C Hamanob713ff12008-05-24 01:12:3078Do not update the server information with
Junio C Hamano1aa40d22010-01-21 17:46:4379'git update-server-info'. This option skips
Junio C Hamanob713ff12008-05-24 01:12:3080updating local catalog files needed to publish
81this repository (or a direct copy of it)
Junio C Hamanoba4b9282008-07-06 05:20:3182over HTTP or FTP. See linkgit:git-update-server-info[1].
Junio C Hamano1a4e8412005-12-27 08:17:2383
Junio C Hamanod2179ef2010-10-22 04:12:1784--window=<n>::
85--depth=<n>::
Junio C Hamano93567a62006-10-08 08:47:5686These two options affect how the objects contained in the pack are
Junio C Hamano3eb513f2006-09-18 02:47:1687stored using delta compression. The objects are first internally
88sorted by type, size and optionally names and compared against the
89other objects within `--window` to see if using delta compression saves
90space. `--depth` limits the maximum delta depth; making it too deep
91affects the performance on the unpacker side, because delta data needs
92to be applied that many times to get to the necessary object.
Junio C Hamano91d44c52007-05-09 07:16:0793The default value for --window is 10 and --depth is 50.
Junio C Hamano3eb513f2006-09-18 02:47:1694
Junio C Hamano6b6144f2017-05-29 06:20:1595--threads=<n>::
96This option is passed through to `git pack-objects`.
97
Junio C Hamanod2179ef2010-10-22 04:12:1798--window-memory=<n>::
Junio C Hamano235d53f2007-07-13 00:25:1599This option provides an additional limit on top of `--window`;
100the window size will dynamically scale down so as to not take
Junio C Hamanod2179ef2010-10-22 04:12:17101up more than '<n>' bytes in memory. This is useful in
Junio C Hamano235d53f2007-07-13 00:25:15102repositories with a mix of large and small objects to not run
103out of memory with a large window, but still be able to take
104advantage of the large window for the smaller objects. The
105size can be suffixed with "k", "m", or "g".
Junio C Hamano0f1d17c2016-08-12 19:42:26106`--window-memory=0` makes memory usage unlimited. The default
107is taken from the `pack.windowMemory` configuration variable.
108Note that the actual memory usage will be the limit multiplied
109by the number of threads used by linkgit:git-pack-objects[1].
Junio C Hamano235d53f2007-07-13 00:25:15110
Junio C Hamanod2179ef2010-10-22 04:12:17111--max-pack-size=<n>::
Junio C Hamano4d979582010-02-04 06:27:29112Maximum size of each output pack file. The size can be suffixed with
113"k", "m", or "g". The minimum size allowed is limited to 1 MiB.
Junio C Hamano74fd0fc2016-05-10 21:23:56114If specified, multiple packfiles may be created, which also
115prevents the creation of a bitmap index.
Junio C Hamano4d979582010-02-04 06:27:29116The default is unlimited, unless the config variable
117`pack.packSizeLimit` is set.
Junio C Hamano591dc6a2007-05-29 09:18:19118
Junio C Hamano5b3533d2014-02-27 23:07:15119-b::
120--write-bitmap-index::
121Write a reachability bitmap index as part of the repack. This
122only makes sense when used with `-a` or `-A`, as the bitmaps
123must be able to refer to all reachable objects. This option
Junio C Hamano74fd0fc2016-05-10 21:23:56124overrides the setting of `repack.writeBitmaps`. This option
125has no effect if multiple packfiles are created.
Junio C Hamano5b3533d2014-02-27 23:07:15126
Junio C Hamano3b0cdc22014-03-18 22:06:16127--pack-kept-objects::
128Include objects in `.keep` files when repacking. Note that we
129still do not delete `.keep` packs after `pack-objects` finishes.
130This means that we may duplicate objects, but this makes the
131option safe to use when there are concurrent pushes or fetches.
132This option is generally only useful if you are writing bitmaps
Junio C Hamano74fd0fc2016-05-10 21:23:56133with `-b` or `repack.writeBitmaps`, as it ensures that the
Junio C Hamano3b0cdc22014-03-18 22:06:16134bitmapped packfile has the necessary objects.
Junio C Hamano3eb513f2006-09-18 02:47:16135
Junio C Hamanoc6c919b2016-07-06 21:34:15136--unpack-unreachable=<when>::
137When loosening unreachable objects, do not bother loosening any
138objects older than `<when>`. This can be used to optimize out
139the write of any objects that would be immediately pruned by
140a follow-up `git prune`.
141
142-k::
143--keep-unreachable::
144When used with `-ad`, any unreachable objects from existing
145packs will be appended to the end of the packfile instead of
146being removed. In addition, any unreachable loose objects will
147be packed (and their loose counterparts removed).
148
Junio C Hamano77b7e902006-10-23 07:18:50149Configuration
150-------------
151
Junio C Hamanod3304322010-02-05 03:28:27152By default, the command passes `--delta-base-offset` option to
153'git pack-objects'; this typically results in slightly smaller packs,
154but the generated packs are incompatible with versions of Git older than
155version 1.4.4. If you need to share your repository with such ancient Git
Junio C Hamanof85ef632016-02-17 22:31:06156versions, either directly or via the dumb http protocol, then you
Junio C Hamanod3304322010-02-05 03:28:27157need to set the configuration variable `repack.UseDeltaBaseOffset` to
158"false" and repack. Access from old Git versions over the native protocol
159is unaffected by this option as the conversion is performed on the fly
160as needed in that case.
Junio C Hamano77b7e902006-10-23 07:18:50161
Junio C Hamano9049d912008-05-29 02:09:50162SEE ALSO
Junio C Hamano1a4e8412005-12-27 08:17:23163--------
Junio C Hamano35738e82008-01-07 07:55:46164linkgit:git-pack-objects[1]
165linkgit:git-prune-packed[1]
Junio C Hamano1a4e8412005-12-27 08:17:23166
167GIT
168---
Junio C Hamanof7c042d2008-06-06 22:50:53169Part of the linkgit:git[1] suite