interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / Documentation / git-repack.adoc

367 lines · 15015 bytes Raw Blame History
1git-repack(1)
2=============
3
4NAME
5----
6git-repack - Pack unpacked objects in a repository
7
8
9SYNOPSIS
10--------
11[verse]
12'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
13 [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
14 [--write-midx[=<mode>]] [--name-hash-version=<n>] [--path-walk]
15 [--filter=<filter-spec>] [--drop-filtered [--dry-run]]
16
17DESCRIPTION
18-----------
19
20This command is used to combine all objects that do not currently
21reside in a "pack", into a pack. It can also be used to re-organize
22existing packs into a single, more efficient pack.
23
24A pack is a collection of objects, individually compressed, with
25delta compression applied, stored in a single file, with an
26associated index file.
27
28Packs are used to reduce the load on mirror systems, backup
29engines, disk storage, etc.
30
31OPTIONS
32-------
33
34-a::
35 Instead of incrementally packing the unpacked objects,
36 pack everything referenced into a single pack.
37 Especially useful when packing a repository that is used
38 for private development. Use
39 with `-d`. This will clean up the objects that `git prune`
40 leaves behind, but `git fsck --full --dangling` shows as
41 dangling.
42+
43Note that users fetching over dumb protocols will have to fetch the
44whole new pack in order to get any contained object, no matter how many
45other objects in that pack they already have locally.
46+
47Promisor packfiles are repacked separately: if there are packfiles that
48have an associated ".promisor" file, these packfiles will be repacked
49into another separate pack, and an empty ".promisor" file corresponding
50to the new separate pack will be written.
51
52-A::
53 Same as `-a`, unless `-d` is used. Then any unreachable
54 objects in a previous pack become loose, unpacked objects,
55 instead of being left in the old pack. Unreachable objects
56 are never intentionally added to a pack, even when repacking.
57 This option prevents unreachable objects from being immediately
58 deleted by way of being left in the old pack and then
59 removed. Instead, the loose unreachable objects
60 will be pruned according to normal expiry rules
61 with the next 'git gc' invocation. See linkgit:git-gc[1].
62
63-d::
64 After packing, if the newly created packs make some
65 existing packs redundant, remove the redundant packs.
66 Also run 'git prune-packed' to remove redundant
67 loose object files.
68
69--cruft::
70 Same as `-a`, unless `-d` is used. Then any unreachable objects
71 are packed into a separate cruft pack. Unreachable objects can
72 be pruned using the normal expiry rules with the next `git gc`
73 invocation (see linkgit:git-gc[1]). Incompatible with `-k`.
74
75--cruft-expiration=<approxidate>::
76 Expire unreachable objects older than `<approxidate>`
77 immediately instead of waiting for the next `git gc` invocation.
78 Only useful with `--cruft -d`.
79
80--max-cruft-size=<n>::
81 Override `--max-pack-size` for cruft packs. Inherits the value of
82 `--max-pack-size` (if any) by default. See the documentation for
83 `--max-pack-size` for more details.
84
85--combine-cruft-below-size=<n>::
86 When generating cruft packs without pruning, only repack
87 existing cruft packs whose size is strictly less than `<n>`
88 bytes, which can optionally
89 be suffixed with "k", "m", or "g". Cruft packs whose size is
90 greater than or equal to `<n>` are left as-is and not repacked.
91 Useful when you want to avoid repacking large cruft pack(s) in
92 repositories that have many and/or large unreachable objects.
93
94--expire-to=<dir>::
95 Write a cruft pack containing pruned objects (if any) to the
96 directory `<dir>`. This option is useful for keeping a copy of
97 any pruned objects in a separate directory as a backup. Only
98 useful with `--cruft -d`.
99
100-l::
101 Pass the `--local` option to 'git pack-objects'. See
102 linkgit:git-pack-objects[1].
103
104-f::
105 Pass the `--no-reuse-delta` option to `git-pack-objects`, see
106 linkgit:git-pack-objects[1].
107
108-F::
109 Pass the `--no-reuse-object` option to `git-pack-objects`, see
110 linkgit:git-pack-objects[1].
111
112-q::
113--quiet::
114 Show no progress over the standard error stream and pass the `-q`
115 option to 'git pack-objects'. See linkgit:git-pack-objects[1].
116
117-n::
118 Do not update the server information with
119 'git update-server-info'. This option skips
120 updating local catalog files needed to publish
121 this repository (or a direct copy of it)
122 over HTTP or FTP. See linkgit:git-update-server-info[1].
123
124--window=<n>::
125--depth=<n>::
126 These two options affect how the objects contained in the pack are
127 stored using delta compression. The objects are first internally
128 sorted by type, size and optionally names and compared against the
129 other objects within `--window` to see if using delta compression saves
130 space. `--depth` limits the maximum delta depth; making it too deep
131 affects the performance on the unpacker side, because delta data needs
132 to be applied that many times to get to the necessary object.
133+
134The default value for --window is 10 and --depth is 50. The maximum
135depth is 4095.
136
137--threads=<n>::
138 This option is passed through to `git pack-objects`.
139
140--window-memory=<n>::
141 This option provides an additional limit on top of `--window`;
142 the window size will dynamically scale down so as to not take
143 up more than '<n>' bytes in memory. This is useful in
144 repositories with a mix of large and small objects to not run
145 out of memory with a large window, but still be able to take
146 advantage of the large window for the smaller objects. The
147 size can be suffixed with "k", "m", or "g".
148 `--window-memory=0` makes memory usage unlimited. The default
149 is taken from the `pack.windowMemory` configuration variable.
150 Note that the actual memory usage will be the limit multiplied
151 by the number of threads used by linkgit:git-pack-objects[1].
152
153--max-pack-size=<n>::
154 Maximum size of each output pack file. The size can be suffixed with
155 "k", "m", or "g". The minimum size allowed is limited to 1 MiB.
156 If specified, multiple packfiles may be created, which also
157 prevents the creation of a bitmap index.
158 The default is unlimited, unless the config variable
159 `pack.packSizeLimit` is set. Note that this option may result in
160 a larger and slower repository; see the discussion in
161 `pack.packSizeLimit`.
162
163--filter=<filter-spec>::
164 Remove objects matching the filter specification from the
165 resulting packfile and put them into a separate packfile. Note
166 that objects used in the working directory are not filtered
167 out. So for the split to fully work, it's best to perform it
168 in a bare repo and to use the `-a` and `-d` options along with
169 this option. Also `--no-write-bitmap-index` (or the
170 `repack.writebitmaps` config option set to `false`) should be
171 used otherwise writing bitmap index will fail, as it supposes
172 a single packfile containing all the objects. See
173 linkgit:git-rev-list[1] for valid `<filter-spec>` forms.
174
175--filter-to=<dir>::
176 Write the pack containing filtered out objects to the
177 directory `<dir>`. Only useful with `--filter`. This can be
178 used for putting the pack on a separate object directory that
179 is accessed through the Git alternates mechanism. **WARNING:**
180 If the packfile containing the filtered out objects is not
181 accessible, the repo can become corrupt as it might not be
182 possible to access the objects in that packfile. See the
183 `objects` and `objects/info/alternates` sections of
184 linkgit:gitrepository-layout[5].
185
186--drop-filtered::
187 Delete the local objects that match the `--filter` specification
188 instead of keeping them in a separate packfile, reclaiming the
189 disk space they occupy. This is intended for partial clones,
190 where the filtered objects are promisor objects that remain
191 recoverable from the promisor remote and are lazily re-fetched
192 on demand when they are next needed.
193+
194Only large blobs are supported for now, so `--filter=blob:limit=<n>`
195is currently the only accepted filter. Because dropped objects must be
196recoverable, this option requires a promisor remote to be configured
197and refuses to run otherwise.
198+
199This option requires `-a`, and implies `-d`: the objects are dropped by
200rebuilding the promisor pack without them and then removing the now
201redundant old packs, so the redundant packs must be deleted for the
202space to actually be reclaimed. It is incompatible with `--filter-to`
203and with bitmap writing (`-b`/`--write-bitmap-index`), since filtering
204breaks the single-pack closure that bitmaps require. A bitmap setting
205coming from configuration is silently disabled for the duration of the
206command.
207+
208As a convenience, since dropped objects remain recoverable by lazy fetch,
209`--drop-filtered` refuses to run while another operation
210(merge, rebase, am, cherry-pick, revert, or bisect) is in progress, to
211avoid a surprising network fetch mid-operation, and refuses to drop any
212blob that the current index references, since such a blob would only be
213lazily re-fetched by the next command that inspects the working tree.
214These checks are skipped in bare repositories, which have neither a
215working tree nor an index.
216
217--dry-run::
218 Only meaningful with `--drop-filtered`. List the objects that
219 would be dropped, one object ID per line, without rebuilding any
220 pack or deleting anything.
221
222-b::
223--write-bitmap-index::
224 Write a reachability bitmap index as part of the repack. This
225 only makes sense when used with `-a`, `-A` or `-m`, as the bitmaps
226 must be able to refer to all reachable objects. This option
227 overrides the setting of `repack.writeBitmaps`. This option
228 has no effect if multiple packfiles are created, unless writing a
229 MIDX (in which case a multi-pack bitmap is created).
230
231--pack-kept-objects::
232 Include objects in `.keep` files when repacking. Note that we
233 still do not delete `.keep` packs after `pack-objects` finishes.
234 This means that we may duplicate objects, but this makes the
235 option safe to use when there are concurrent pushes or fetches.
236 This option is generally only useful if you are writing bitmaps
237 with `-b` or `repack.writeBitmaps`, as it ensures that the
238 bitmapped packfile has the necessary objects.
239
240--keep-pack=<pack-name>::
241 Exclude the given pack from repacking. This is the equivalent
242 of having `.keep` file on the pack. `<pack-name>` is the
243 pack file name without leading directory (e.g. `pack-123.pack`).
244 The option can be specified multiple times to keep multiple
245 packs.
246
247--unpack-unreachable=<when>::
248 When loosening unreachable objects, do not bother loosening any
249 objects older than `<when>`. This can be used to optimize out
250 the write of any objects that would be immediately pruned by
251 a follow-up `git prune`.
252
253-k::
254--keep-unreachable::
255 When used with `-ad`, any unreachable objects from existing
256 packs will be appended to the end of the packfile instead of
257 being removed. In addition, any unreachable loose objects will
258 be packed (and their loose counterparts removed).
259
260-i::
261--delta-islands::
262 Pass the `--delta-islands` option to `git-pack-objects`, see
263 linkgit:git-pack-objects[1].
264
265-g<factor>::
266--geometric=<factor>::
267 Arrange resulting pack structure so that each successive pack
268 contains at least `<factor>` times the number of objects as the
269 next-largest pack.
270+
271`git repack` ensures this by determining a "cut" of packfiles that need
272to be repacked into one in order to ensure a geometric progression. It
273picks the smallest set of packfiles such that as many of the larger
274packfiles (by count of objects contained in that pack) may be left
275intact.
276+
277Unlike other repack modes, the set of objects to pack is determined
278uniquely by the set of packs being "rolled-up"; in other words, the
279packs determined to need to be combined in order to restore a geometric
280progression.
281+
282Loose objects are implicitly included in this "roll-up", without respect to
283their reachability. This is subject to change in the future.
284+
285When writing a multi-pack bitmap, `git repack` selects the largest resulting
286pack as the preferred pack for object selection by the MIDX (see
287linkgit:git-multi-pack-index[1]).
288
289-m::
290--write-midx[=<mode>]::
291 Write a multi-pack index (see linkgit:git-multi-pack-index[1])
292 containing the non-redundant packs. The following modes are
293 available:
294+
295--
296 `default`;;
297 Write a single MIDX covering all packs. This is the
298 default when `--write-midx` is given without an
299 explicit mode.
300
301 `incremental`;;
302 Write an incremental MIDX chain instead of a single
303 flat MIDX.
304+
305Without `--geometric`, a new MIDX layer is appended to the existing
306chain (or a new chain is started) containing whatever packs were written
307by the repack. Existing layers are preserved as-is.
308+
309When combined with `--geometric`, the incremental mode maintains a chain
310of MIDX layers that is compacted over time using a geometric merging
311strategy. Each repack creates a new tip layer containing the newly
312written pack(s). Adjacent layers are then merged whenever the newer
313layer's object count exceeds `1/repack.midxSplitFactor` of the next
314deeper layer's count. Layers that do not meet this condition are
315retained as-is.
316+
317The result is that newer (tip) layers tend to contain many small packs
318with relatively few objects, while older (deeper) layers contain fewer,
319larger packs covering more objects. Because compaction is driven by the
320tip of the chain, newer layers are also rewritten more frequently than
321older ones, which are only touched when enough objects have accumulated
322to justify merging into them. This keeps the total number of layers
323logarithmic relative to the total number of objects.
324+
325Only packs in the tip MIDX layer are considered as candidates for the
326geometric repack; packs in deeper layers are left untouched. If the tip
327layer contains fewer packs than `repack.midxNewLayerThreshold`, those
328packs are excluded from the geometry entirely, and a new layer is
329created for any new pack(s) without disturbing the existing chain.
330--
331
332--name-hash-version=<n>::
333 Provide this argument to the underlying `git pack-objects` process.
334 See linkgit:git-pack-objects[1] for full details.
335
336--path-walk::
337 Pass the `--path-walk` option to the underlying `git pack-objects`
338 process. See linkgit:git-pack-objects[1] for full details.
339
340CONFIGURATION
341-------------
342
343Various configuration variables affect packing, see
344linkgit:git-config[1] (search for "pack" and "delta").
345
346By default, the command passes `--delta-base-offset` option to
347'git pack-objects'; this typically results in slightly smaller packs,
348but the generated packs are incompatible with versions of Git older than
349version 1.4.4. If you need to share your repository with such ancient Git
350versions, either directly or via the dumb http protocol, then you
351need to set the configuration variable `repack.UseDeltaBaseOffset` to
352"false" and repack. Access from old Git versions over the native protocol
353is unaffected by this option as the conversion is performed on the fly
354as needed in that case.
355
356Delta compression is not used on objects larger than the
357`core.bigFileThreshold` configuration variable and on files with the
358attribute `delta` set to false.
359
360SEE ALSO
361--------
362linkgit:git-pack-objects[1]
363linkgit:git-prune-packed[1]
364
365GIT
366---
367Part of the linkgit:git[1] suite