3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
7 .\" Source: Git 2.48.0.rc0.135.g996f0c583b
10 .TH "GIT\-REPACK" "1" "2024-12-23" "Git 2\&.48\&.0\&.rc0\&.135\&.g" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-repack \- Pack unpacked objects in a repository
35 \fIgit repack\fR [\-a] [\-A] [\-d] [\-f] [\-F] [\-l] [\-n] [\-q] [\-b] [\-m] [\-\-window=<n>] [\-\-depth=<n>] [\-\-threads=<n>] [\-\-keep\-pack=<pack\-name>] [\-\-write\-midx]
39 This command is used to combine all objects that do not currently reside in a "pack", into a pack\&. It can also be used to re\-organize existing packs into a single, more efficient pack\&.
41 A pack is a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an associated index file\&.
43 Packs are used to reduce the load on mirror systems, backup engines, disk storage, etc\&.
48 Instead of incrementally packing the unpacked objects, pack everything referenced into a single pack\&. Especially useful when packing a repository that is used for private development\&. Use with
49 \fB\-d\fR\&. This will clean up the objects that
59 Note that users fetching over dumb protocols will have to fetch the whole new pack in order to get any contained object, no matter how many other objects in that pack they already have locally\&.
61 Promisor packfiles are repacked separately: if there are packfiles that have an associated "\&.promisor" file, these packfiles will be repacked into another separate pack, and an empty "\&.promisor" file corresponding to the new separate pack will be written\&.
69 is used\&. Then any unreachable objects in a previous pack become loose, unpacked objects, instead of being left in the old pack\&. Unreachable objects are never intentionally added to a pack, even when repacking\&. This option prevents unreachable objects from being immediately deleted by way of being left in the old pack and then removed\&. Instead, the loose unreachable objects will be pruned according to normal expiry rules with the next
77 After packing, if the newly created packs make some existing packs redundant, remove the redundant packs\&. Also run
78 \fIgit prune\-packed\fR
79 to remove redundant loose object files\&.
87 is used\&. Then any unreachable objects are packed into a separate cruft pack\&. Unreachable objects can be pruned using the normal expiry rules with the next
91 \fBgit-gc\fR(1))\&. Incompatible with
95 \-\-cruft\-expiration=<approxidate>
97 Expire unreachable objects older than
99 immediately instead of waiting for the next
102 invocation\&. Only useful with
107 \-\-max\-cruft\-size=<n>
109 Repack cruft objects into packs as large as
111 bytes before creating new packs\&. As long as there are enough cruft packs smaller than
112 \fI<n>\fR, repacking will cause a new cruft pack to be created containing objects from any combined cruft packs, along with any new unreachable objects\&. Cruft packs larger than
114 will not be modified\&. When the new cruft pack is larger than
116 bytes, it will be split into multiple packs, all of which are guaranteed to be at most
118 bytes in size\&. Only useful with
125 Write a cruft pack containing pruned objects (if any) to the directory
126 \fI<dir>\fR\&. This option is useful for keeping a copy of any pruned objects in a separate directory as a backup\&. Only useful with
136 \fIgit pack\-objects\fR\&. See
137 \fBgit-pack-objects\fR(1)\&.
143 \fB\-\-no\-reuse\-delta\fR
145 \fBgit\-pack\-objects\fR, see
146 \fBgit-pack-objects\fR(1)\&.
152 \fB\-\-no\-reuse\-object\fR
154 \fBgit\-pack\-objects\fR, see
155 \fBgit-pack-objects\fR(1)\&.
160 Show no progress over the standard error stream and pass the
163 \fIgit pack\-objects\fR\&. See
164 \fBgit-pack-objects\fR(1)\&.
169 Do not update the server information with
170 \fIgit update\-server\-info\fR\&. This option skips updating local catalog files needed to publish this repository (or a direct copy of it) over HTTP or FTP\&. See
171 \fBgit-update-server-info\fR(1)\&.
174 \-\-window=<n>, \-\-depth=<n>
176 These two options affect how the objects contained in the pack are stored using delta compression\&. The objects are first internally sorted by type, size and optionally names and compared against the other objects within
178 to see if using delta compression saves space\&.
180 limits the maximum delta depth; making it too deep affects the performance on the unpacker side, because delta data needs to be applied that many times to get to the necessary object\&.
182 The default value for \-\-window is 10 and \-\-depth is 50\&. The maximum depth is 4095\&.
187 This option is passed through to
189 \fBpack\-objects\fR\&.
192 \-\-window\-memory=<n>
194 This option provides an additional limit on top of
195 \fB\-\-window\fR; the window size will dynamically scale down so as to not take up more than
197 bytes in memory\&. This is useful in repositories with a mix of large and small objects to not run out of memory with a large window, but still be able to take advantage of the large window for the smaller objects\&. The size can be suffixed with "k", "m", or "g"\&.
198 \fB\-\-window\-memory=0\fR
199 makes memory usage unlimited\&. The default is taken from the
200 \fBpack\&.windowMemory\fR
201 configuration variable\&. Note that the actual memory usage will be the limit multiplied by the number of threads used by
202 \fBgit-pack-objects\fR(1)\&.
205 \-\-max\-pack\-size=<n>
207 Maximum size of each output pack file\&. The size can be suffixed with "k", "m", or "g"\&. The minimum size allowed is limited to 1 MiB\&. If specified, multiple packfiles may be created, which also prevents the creation of a bitmap index\&. The default is unlimited, unless the config variable
208 \fBpack\&.packSizeLimit\fR
209 is set\&. Note that this option may result in a larger and slower repository; see the discussion in
210 \fBpack\&.packSizeLimit\fR\&.
213 \-\-filter=<filter\-spec>
215 Remove objects matching the filter specification from the resulting packfile and put them into a separate packfile\&. Note that objects used in the working directory are not filtered out\&. So for the split to fully work, it\(cqs best to perform it in a bare repo and to use the
219 options along with this option\&. Also
220 \fB\-\-no\-write\-bitmap\-index\fR
222 \fBrepack\&.writebitmaps\fR
224 \fBfalse\fR) should be used otherwise writing bitmap index will fail, as it supposes a single packfile containing all the objects\&. See
225 \fBgit-rev-list\fR(1)
233 Write the pack containing filtered out objects to the directory
234 \fI<dir>\fR\&. Only useful with
235 \fB\-\-filter\fR\&. This can be used for putting the pack on a separate object directory that is accessed through the Git alternates mechanism\&.
237 If the packfile containing the filtered out objects is not accessible, the repo can become corrupt as it might not be possible to access the objects in that packfile\&. See the
240 \fBobjects/info/alternates\fR
242 \fBgitrepository-layout\fR(5)\&.
245 \-b, \-\-write\-bitmap\-index
247 Write a reachability bitmap index as part of the repack\&. This only makes sense when used with
251 \fB\-m\fR, as the bitmaps must be able to refer to all reachable objects\&. This option overrides the setting of
252 \fBrepack\&.writeBitmaps\fR\&. This option has no effect if multiple packfiles are created, unless writing a MIDX (in which case a multi\-pack bitmap is created)\&.
255 \-\-pack\-kept\-objects
257 Include objects in \&.\fBkeep\fR
258 files when repacking\&. Note that we still do not delete \&.\fBkeep\fR
261 finishes\&. This means that we may duplicate objects, but this makes the option safe to use when there are concurrent pushes or fetches\&. This option is generally only useful if you are writing bitmaps with
264 \fBrepack\&.writeBitmaps\fR, as it ensures that the bitmapped packfile has the necessary objects\&.
267 \-\-keep\-pack=<pack\-name>
269 Exclude the given pack from repacking\&. This is the equivalent of having \&.\fBkeep\fR
272 is the pack file name without leading directory (e\&.g\&.
273 \fBpack\-123\&.pack\fR)\&. The option can be specified multiple times to keep multiple packs\&.
276 \-\-unpack\-unreachable=<when>
278 When loosening unreachable objects, do not bother loosening any objects older than
279 \fI<when>\fR\&. This can be used to optimize out the write of any objects that would be immediately pruned by a follow\-up
284 \-k, \-\-keep\-unreachable
287 \fB\-ad\fR, any unreachable objects from existing packs will be appended to the end of the packfile instead of being removed\&. In addition, any unreachable loose objects will be packed (and their loose counterparts removed)\&.
290 \-i, \-\-delta\-islands
293 \fB\-\-delta\-islands\fR
295 \fBgit\-pack\-objects\fR, see
296 \fBgit-pack-objects\fR(1)\&.
299 \-g<factor>, \-\-geometric=<factor>
301 Arrange resulting pack structure so that each successive pack contains at least
303 times the number of objects as the next\-largest pack\&.
307 ensures this by determining a "cut" of packfiles that need to be repacked into one in order to ensure a geometric progression\&. It picks the smallest set of packfiles such that as many of the larger packfiles (by count of objects contained in that pack) may be left intact\&.
309 Unlike other repack modes, the set of objects to pack is determined uniquely by the set of packs being "rolled\-up"; in other words, the packs determined to need to be combined in order to restore a geometric progression\&.
311 Loose objects are implicitly included in this "roll\-up", without respect to their reachability\&. This is subject to change in the future\&.
313 When writing a multi\-pack bitmap,
316 selects the largest resulting pack as the preferred pack for object selection by the MIDX (see
317 \fBgit-multi-pack-index\fR(1))\&.
322 Write a multi\-pack index (see
323 \fBgit-multi-pack-index\fR(1)) containing the non\-redundant packs\&.
327 Various configuration variables affect packing, see \fBgit-config\fR(1) (search for "pack" and "delta")\&.
329 By default, the command passes \fB\-\-delta\-base\-offset\fR option to \fIgit pack\-objects\fR; this typically results in slightly smaller packs, but the generated packs are incompatible with versions of Git older than version 1\&.4\&.4\&. If you need to share your repository with such ancient Git versions, either directly or via the dumb http protocol, then you need to set the configuration variable \fBrepack\&.UseDeltaBaseOffset\fR to "false" and repack\&. Access from old Git versions over the native protocol is unaffected by this option as the conversion is performed on the fly as needed in that case\&.
331 Delta compression is not used on objects larger than the \fBcore\&.bigFileThreshold\fR configuration variable and on files with the attribute \fBdelta\fR set to false\&.
334 \fBgit-pack-objects\fR(1) \fBgit-prune-packed\fR(1)
337 Part of the \fBgit\fR(1) suite