]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-repack.txt
Start the 2.46 cycle
[thirdparty/git.git] / Documentation / git-repack.txt
CommitLineData
215a7ad1
JH
1git-repack(1)
2=============
e31bb3bb
JH
3
4NAME
5----
c3f0baac 6git-repack - Pack unpacked objects in a repository
e31bb3bb
JH
7
8
9SYNOPSIS
10--------
7791a1d9 11[verse]
1d89d88d 12'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>] [--write-midx]
e31bb3bb
JH
13
14DESCRIPTION
15-----------
e31bb3bb 16
35c14176 17This command is used to combine all objects that do not currently
02783075 18reside in a "pack", into a pack. It can also be used to re-organize
38d697a1 19existing packs into a single, more efficient pack.
f85a4191
JH
20
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::
32 Instead of incrementally packing the unpacked objects,
38d697a1 33 pack everything referenced into a single pack.
f85a4191 34 Especially useful when packing a repository that is used
9a8531ee 35 for private development. Use
23f8239b 36 with `-d`. This will clean up the objects that `git prune`
c6a13b2c 37 leaves behind, but `git fsck --full --dangling` shows as
38d697a1 38 dangling.
9a8531ee
MG
39+
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.
5d19e813
JT
43+
44Promisor packfiles are repacked separately: if there are packfiles that
45have an associated ".promisor" file, these packfiles will be repacked
46into another separate pack, and an empty ".promisor" file corresponding
47to the new separate pack will be written.
f85a4191 48
bbefaa1f 49-A::
23f8239b 50 Same as `-a`, unless `-d` is used. Then any unreachable
83d0289d
BC
51 objects in a previous pack become loose, unpacked objects,
52 instead of being left in the old pack. Unreachable objects
53 are never intentionally added to a pack, even when repacking.
54 This option prevents unreachable objects from being immediately
bbefaa1f
CF
55 deleted by way of being left in the old pack and then
56 removed. Instead, the loose unreachable objects
57 will be pruned according to normal expiry rules
0b444cdb 58 with the next 'git gc' invocation. See linkgit:git-gc[1].
bbefaa1f 59
f85a4191
JH
60-d::
61 After packing, if the newly created packs make some
62 existing packs redundant, remove the redundant packs.
0b444cdb 63 Also run 'git prune-packed' to remove redundant
483bc4f0 64 loose object files.
e31bb3bb 65
f9825d1c
TB
66--cruft::
67 Same as `-a`, unless `-d` is used. Then any unreachable objects
68 are packed into a separate cruft pack. Unreachable objects can
69 be pruned using the normal expiry rules with the next `git gc`
70 invocation (see linkgit:git-gc[1]). Incompatible with `-k`.
71
72--cruft-expiration=<approxidate>::
73 Expire unreachable objects older than `<approxidate>`
74 immediately instead of waiting for the next `git gc` invocation.
75 Only useful with `--cruft -d`.
76
37dc6d81
TB
77--max-cruft-size=<n>::
78 Repack cruft objects into packs as large as `<n>` bytes before
79 creating new packs. As long as there are enough cruft packs
80 smaller than `<n>`, repacking will cause a new cruft pack to
81 be created containing objects from any combined cruft packs,
82 along with any new unreachable objects. Cruft packs larger than
83 `<n>` will not be modified. When the new cruft pack is larger
84 than `<n>` bytes, it will be split into multiple packs, all of
85 which are guaranteed to be at most `<n>` bytes in size. Only
86 useful with `--cruft -d`.
87
91badeba
TB
88--expire-to=<dir>::
89 Write a cruft pack containing pruned objects (if any) to the
90 directory `<dir>`. This option is useful for keeping a copy of
91 any pruned objects in a separate directory as a backup. Only
92 useful with `--cruft -d`.
93
31f23281 94-l::
0b444cdb 95 Pass the `--local` option to 'git pack-objects'. See
5162e697 96 linkgit:git-pack-objects[1].
31f23281 97
cec2be76 98-f::
5c47e1c7
JK
99 Pass the `--no-reuse-delta` option to `git-pack-objects`, see
100 linkgit:git-pack-objects[1].
101
102-F::
8d11fdea 103 Pass the `--no-reuse-object` option to `git-pack-objects`, see
5162e697 104 linkgit:git-pack-objects[1].
cec2be76
JH
105
106-q::
47ca93d0
DS
107--quiet::
108 Show no progress over the standard error stream and pass the `-q`
109 option to 'git pack-objects'. See linkgit:git-pack-objects[1].
cec2be76 110
31f23281 111-n::
c30f9936 112 Do not update the server information with
0b444cdb 113 'git update-server-info'. This option skips
c30f9936
SP
114 updating local catalog files needed to publish
115 this repository (or a direct copy of it)
0cafe944 116 over HTTP or FTP. See linkgit:git-update-server-info[1].
e31bb3bb 117
62b4698e
ŠN
118--window=<n>::
119--depth=<n>::
3df19671 120 These two options affect how the objects contained in the pack are
02ac04fc
JF
121 stored using delta compression. The objects are first internally
122 sorted by type, size and optionally names and compared against the
123 other objects within `--window` to see if using delta compression saves
124 space. `--depth` limits the maximum delta depth; making it too deep
125 affects the performance on the unpacker side, because delta data needs
126 to be applied that many times to get to the necessary object.
b5c0cbd8
NTND
127+
128The default value for --window is 10 and --depth is 50. The maximum
129depth is 4095.
02ac04fc 130
40bcf318
JH
131--threads=<n>::
132 This option is passed through to `git pack-objects`.
133
62b4698e 134--window-memory=<n>::
e93b15cd
BD
135 This option provides an additional limit on top of `--window`;
136 the window size will dynamically scale down so as to not take
62b4698e 137 up more than '<n>' bytes in memory. This is useful in
e93b15cd
BD
138 repositories with a mix of large and small objects to not run
139 out of memory with a large window, but still be able to take
140 advantage of the large window for the smaller objects. The
141 size can be suffixed with "k", "m", or "g".
954176c1
MS
142 `--window-memory=0` makes memory usage unlimited. The default
143 is taken from the `pack.windowMemory` configuration variable.
144 Note that the actual memory usage will be the limit multiplied
145 by the number of threads used by linkgit:git-pack-objects[1].
e93b15cd 146
62b4698e 147--max-pack-size=<n>::
07cf0f24
NP
148 Maximum size of each output pack file. The size can be suffixed with
149 "k", "m", or "g". The minimum size allowed is limited to 1 MiB.
9cea46cd
EW
150 If specified, multiple packfiles may be created, which also
151 prevents the creation of a bitmap index.
07cf0f24 152 The default is unlimited, unless the config variable
6fb9195f
JK
153 `pack.packSizeLimit` is set. Note that this option may result in
154 a larger and slower repository; see the discussion in
155 `pack.packSizeLimit`.
6b94b1a0 156
48a9b67b
CC
157--filter=<filter-spec>::
158 Remove objects matching the filter specification from the
159 resulting packfile and put them into a separate packfile. Note
160 that objects used in the working directory are not filtered
161 out. So for the split to fully work, it's best to perform it
162 in a bare repo and to use the `-a` and `-d` options along with
163 this option. Also `--no-write-bitmap-index` (or the
164 `repack.writebitmaps` config option set to `false`) should be
165 used otherwise writing bitmap index will fail, as it supposes
166 a single packfile containing all the objects. See
167 linkgit:git-rev-list[1] for valid `<filter-spec>` forms.
168
71c5aec1
CC
169--filter-to=<dir>::
170 Write the pack containing filtered out objects to the
171 directory `<dir>`. Only useful with `--filter`. This can be
172 used for putting the pack on a separate object directory that
173 is accessed through the Git alternates mechanism. **WARNING:**
174 If the packfile containing the filtered out objects is not
175 accessible, the repo can become corrupt as it might not be
176 possible to access the objects in that packfile. See the
177 `objects` and `objects/info/alternates` sections of
178 linkgit:gitrepository-layout[5].
179
5cf2741c
VM
180-b::
181--write-bitmap-index::
182 Write a reachability bitmap index as part of the repack. This
1d89d88d 183 only makes sense when used with `-a`, `-A` or `-m`, as the bitmaps
5cf2741c 184 must be able to refer to all reachable objects. This option
1d89d88d
TB
185 overrides the setting of `repack.writeBitmaps`. This option
186 has no effect if multiple packfiles are created, unless writing a
187 MIDX (in which case a multi-pack bitmap is created).
5cf2741c 188
ee34a2be
JK
189--pack-kept-objects::
190 Include objects in `.keep` files when repacking. Note that we
191 still do not delete `.keep` packs after `pack-objects` finishes.
192 This means that we may duplicate objects, but this makes the
193 option safe to use when there are concurrent pushes or fetches.
194 This option is generally only useful if you are writing bitmaps
9cea46cd 195 with `-b` or `repack.writeBitmaps`, as it ensures that the
ee34a2be 196 bitmapped packfile has the necessary objects.
02ac04fc 197
ed7e5fc3
NTND
198--keep-pack=<pack-name>::
199 Exclude the given pack from repacking. This is the equivalent
24966cd9 200 of having `.keep` file on the pack. `<pack-name>` is the
ed7e5fc3 201 pack file name without leading directory (e.g. `pack-123.pack`).
cf6cac20 202 The option can be specified multiple times to keep multiple
ed7e5fc3
NTND
203 packs.
204
6a7bcb54
JK
205--unpack-unreachable=<when>::
206 When loosening unreachable objects, do not bother loosening any
207 objects older than `<when>`. This can be used to optimize out
208 the write of any objects that would be immediately pruned by
209 a follow-up `git prune`.
210
905f27b8
JK
211-k::
212--keep-unreachable::
213 When used with `-ad`, any unreachable objects from existing
214 packs will be appended to the end of the packfile instead of
e26a8c47
JK
215 being removed. In addition, any unreachable loose objects will
216 be packed (and their loose counterparts removed).
905f27b8 217
16d75fa4
JK
218-i::
219--delta-islands::
220 Pass the `--delta-islands` option to `git-pack-objects`, see
221 linkgit:git-pack-objects[1].
222
e9cc3a02 223-g<factor>::
0fabafd0
TB
224--geometric=<factor>::
225 Arrange resulting pack structure so that each successive pack
226 contains at least `<factor>` times the number of objects as the
227 next-largest pack.
228+
229`git repack` ensures this by determining a "cut" of packfiles that need
230to be repacked into one in order to ensure a geometric progression. It
231picks the smallest set of packfiles such that as many of the larger
232packfiles (by count of objects contained in that pack) may be left
233intact.
234+
235Unlike other repack modes, the set of objects to pack is determined
236uniquely by the set of packs being "rolled-up"; in other words, the
237packs determined to need to be combined in order to restore a geometric
238progression.
239+
ca3285dd
PS
240Loose objects are implicitly included in this "roll-up", without respect to
241their reachability. This is subject to change in the future.
6d08b9d4
TB
242+
243When writing a multi-pack bitmap, `git repack` selects the largest resulting
244pack as the preferred pack for object selection by the MIDX (see
245linkgit:git-multi-pack-index[1]).
0fabafd0 246
1d89d88d
TB
247-m::
248--write-midx::
249 Write a multi-pack index (see linkgit:git-multi-pack-index[1])
250 containing the non-redundant packs.
251
3a837b58 252CONFIGURATION
b6945f57
JH
253-------------
254
3a837b58
CW
255Various configuration variables affect packing, see
256linkgit:git-config[1] (search for "pack" and "delta").
257
9f17688d
NP
258By default, the command passes `--delta-base-offset` option to
259'git pack-objects'; this typically results in slightly smaller packs,
260but the generated packs are incompatible with versions of Git older than
261version 1.4.4. If you need to share your repository with such ancient Git
0d0bac67 262versions, either directly or via the dumb http protocol, then you
9f17688d
NP
263need to set the configuration variable `repack.UseDeltaBaseOffset` to
264"false" and repack. Access from old Git versions over the native protocol
265is unaffected by this option as the conversion is performed on the fly
266as needed in that case.
b6945f57 267
3a837b58
CW
268Delta compression is not used on objects larger than the
269`core.bigFileThreshold` configuration variable and on files with the
270attribute `delta` set to false.
271
56ae8df5 272SEE ALSO
e31bb3bb 273--------
5162e697
DM
274linkgit:git-pack-objects[1]
275linkgit:git-prune-packed[1]
e31bb3bb
JH
276
277GIT
278---
9e1f0a85 279Part of the linkgit:git[1] suite