1GIT-PACK-OBJECTS(1)               Git Manual               GIT-PACK-OBJECTS(1)
2
3
4

NAME

6       git-pack-objects - Create a packed archive of objects
7

SYNOPSIS

9       git pack-objects [-q | --progress | --all-progress] [--all-progress-implied]
10               [--no-reuse-delta] [--delta-base-offset] [--non-empty]
11               [--local] [--incremental] [--window=<n>] [--depth=<n>]
12               [--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
13               [--stdout [--filter=<filter-spec>] | <base-name>]
14               [--shallow] [--keep-true-parents] [--[no-]sparse] < <object-list>
15

DESCRIPTION

17       Reads list of objects from the standard input, and writes either one or
18       more packed archives with the specified base-name to disk, or a packed
19       archive to the standard output.
20
21       A packed archive is an efficient way to transfer a set of objects
22       between two repositories as well as an access efficient archival
23       format. In a packed archive, an object is either stored as a compressed
24       whole or as a difference from some other object. The latter is often
25       called a delta.
26
27       The packed archive format (.pack) is designed to be self-contained so
28       that it can be unpacked without any further information. Therefore,
29       each object that a delta depends upon must be present within the pack.
30
31       A pack index file (.idx) is generated for fast, random access to the
32       objects in the pack. Placing both the index file (.idx) and the packed
33       archive (.pack) in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or
34       any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES) enables
35       Git to read from the pack archive.
36
37       The git unpack-objects command can read the packed archive and expand
38       the objects contained in the pack into "one-file one-object" format;
39       this is typically done by the smart-pull commands when a pack is
40       created on-the-fly for efficient network transport by their peers.
41

OPTIONS

43       base-name
44           Write into pairs of files (.pack and .idx), using <base-name> to
45           determine the name of the created file. When this option is used,
46           the two files in a pair are written in
47           <base-name>-<SHA-1>.{pack,idx} files. <SHA-1> is a hash based on
48           the pack content and is written to the standard output of the
49           command.
50
51       --stdout
52           Write the pack contents (what would have been written to .pack
53           file) out to the standard output.
54
55       --revs
56           Read the revision arguments from the standard input, instead of
57           individual object names. The revision arguments are processed the
58           same way as git rev-list with the --objects flag uses its commit
59           arguments to build the list of objects it outputs. The objects on
60           the resulting list are packed. Besides revisions, --not or
61           --shallow <SHA-1> lines are also accepted.
62
63       --unpacked
64           This implies --revs. When processing the list of revision arguments
65           read from the standard input, limit the objects packed to those
66           that are not already packed.
67
68       --all
69           This implies --revs. In addition to the list of revision arguments
70           read from the standard input, pretend as if all refs under refs/
71           are specified to be included.
72
73       --include-tag
74           Include unasked-for annotated tags if the object they reference was
75           included in the resulting packfile. This can be useful to send new
76           tags to native Git clients.
77
78       --stdin-packs
79           Read the basenames of packfiles (e.g., pack-1234abcd.pack) from the
80           standard input, instead of object names or revision arguments. The
81           resulting pack contains all objects listed in the included packs
82           (those not beginning with ^), excluding any objects listed in the
83           excluded packs (beginning with ^).
84
85           Incompatible with --revs, or options that imply --revs (such as
86           --all), with the exception of --unpacked, which is compatible.
87
88       --window=<n>, --depth=<n>
89           These two options affect how the objects contained in the pack are
90           stored using delta compression. The objects are first internally
91           sorted by type, size and optionally names and compared against the
92           other objects within --window to see if using delta compression
93           saves space. --depth limits the maximum delta depth; making it too
94           deep affects the performance on the unpacker side, because delta
95           data needs to be applied that many times to get to the necessary
96           object.
97
98           The default value for --window is 10 and --depth is 50. The maximum
99           depth is 4095.
100
101       --window-memory=<n>
102           This option provides an additional limit on top of --window; the
103           window size will dynamically scale down so as to not take up more
104           than <n> bytes in memory. This is useful in repositories with a mix
105           of large and small objects to not run out of memory with a large
106           window, but still be able to take advantage of the large window for
107           the smaller objects. The size can be suffixed with "k", "m", or
108           "g".  --window-memory=0 makes memory usage unlimited. The default
109           is taken from the pack.windowMemory configuration variable.
110
111       --max-pack-size=<n>
112           In unusual scenarios, you may not be able to create files larger
113           than a certain size on your filesystem, and this option can be used
114           to tell the command to split the output packfile into multiple
115           independent packfiles, each not larger than the given size. The
116           size can be suffixed with "k", "m", or "g". The minimum size
117           allowed is limited to 1 MiB. The default is unlimited, unless the
118           config variable pack.packSizeLimit is set. Note that this option
119           may result in a larger and slower repository; see the discussion in
120           pack.packSizeLimit.
121
122       --honor-pack-keep
123           This flag causes an object already in a local pack that has a .keep
124           file to be ignored, even if it would have otherwise been packed.
125
126       --keep-pack=<pack-name>
127           This flag causes an object already in the given pack to be ignored,
128           even if it would have otherwise been packed.  <pack-name> is the
129           pack file name without leading directory (e.g.  pack-123.pack). The
130           option could be specified multiple times to keep multiple packs.
131
132       --incremental
133           This flag causes an object already in a pack to be ignored even if
134           it would have otherwise been packed.
135
136       --local
137           This flag causes an object that is borrowed from an alternate
138           object store to be ignored even if it would have otherwise been
139           packed.
140
141       --non-empty
142           Only create a packed archive if it would contain at least one
143           object.
144
145       --progress
146           Progress status is reported on the standard error stream by default
147           when it is attached to a terminal, unless -q is specified. This
148           flag forces progress status even if the standard error stream is
149           not directed to a terminal.
150
151       --all-progress
152           When --stdout is specified then progress report is displayed during
153           the object count and compression phases but inhibited during the
154           write-out phase. The reason is that in some cases the output stream
155           is directly linked to another command which may wish to display
156           progress status of its own as it processes incoming pack data. This
157           flag is like --progress except that it forces progress report for
158           the write-out phase as well even if --stdout is used.
159
160       --all-progress-implied
161           This is used to imply --all-progress whenever progress display is
162           activated. Unlike --all-progress this flag doesn’t actually force
163           any progress display by itself.
164
165       -q
166           This flag makes the command not to report its progress on the
167           standard error stream.
168
169       --no-reuse-delta
170           When creating a packed archive in a repository that has existing
171           packs, the command reuses existing deltas. This sometimes results
172           in a slightly suboptimal pack. This flag tells the command not to
173           reuse existing deltas but compute them from scratch.
174
175       --no-reuse-object
176           This flag tells the command not to reuse existing object data at
177           all, including non deltified object, forcing recompression of
178           everything. This implies --no-reuse-delta. Useful only in the
179           obscure case where wholesale enforcement of a different compression
180           level on the packed data is desired.
181
182       --compression=<n>
183           Specifies compression level for newly-compressed data in the
184           generated pack. If not specified, pack compression level is
185           determined first by pack.compression, then by core.compression, and
186           defaults to -1, the zlib default, if neither is set. Add
187           --no-reuse-object if you want to force a uniform compression level
188           on all data no matter the source.
189
190       --[no-]sparse
191           Toggle the "sparse" algorithm to determine which objects to include
192           in the pack, when combined with the "--revs" option. This algorithm
193           only walks trees that appear in paths that introduce new objects.
194           This can have significant performance benefits when computing a
195           pack to send a small change. However, it is possible that extra
196           objects are added to the pack-file if the included commits contain
197           certain types of direct renames. If this option is not included, it
198           defaults to the value of pack.useSparse, which is true unless
199           otherwise specified.
200
201       --thin
202           Create a "thin" pack by omitting the common objects between a
203           sender and a receiver in order to reduce network transfer. This
204           option only makes sense in conjunction with --stdout.
205
206           Note: A thin pack violates the packed archive format by omitting
207           required objects and is thus unusable by Git without making it
208           self-contained. Use git index-pack --fix-thin (see git-index-
209           pack(1)) to restore the self-contained property.
210
211       --shallow
212           Optimize a pack that will be provided to a client with a shallow
213           repository. This option, combined with --thin, can result in a
214           smaller pack at the cost of speed.
215
216       --delta-base-offset
217           A packed archive can express the base object of a delta as either a
218           20-byte object name or as an offset in the stream, but ancient
219           versions of Git don’t understand the latter. By default, git
220           pack-objects only uses the former format for better compatibility.
221           This option allows the command to use the latter format for
222           compactness. Depending on the average delta chain length, this
223           option typically shrinks the resulting packfile by 3-5 per-cent.
224
225           Note: Porcelain commands such as git gc (see git-gc(1)), git repack
226           (see git-repack(1)) pass this option by default in modern Git when
227           they put objects in your repository into pack files. So does git
228           bundle (see git-bundle(1)) when it creates a bundle.
229
230       --threads=<n>
231           Specifies the number of threads to spawn when searching for best
232           delta matches. This requires that pack-objects be compiled with
233           pthreads otherwise this option is ignored with a warning. This is
234           meant to reduce packing time on multiprocessor machines. The
235           required amount of memory for the delta search window is however
236           multiplied by the number of threads. Specifying 0 will cause Git to
237           auto-detect the number of CPU’s and set the number of threads
238           accordingly.
239
240       --index-version=<version>[,<offset>]
241           This is intended to be used by the test suite only. It allows to
242           force the version for the generated pack index, and to force 64-bit
243           index entries on objects located above the given offset.
244
245       --keep-true-parents
246           With this option, parents that are hidden by grafts are packed
247           nevertheless.
248
249       --filter=<filter-spec>
250           Requires --stdout. Omits certain objects (usually blobs) from the
251           resulting packfile. See git-rev-list(1) for valid <filter-spec>
252           forms.
253
254       --no-filter
255           Turns off any previous --filter= argument.
256
257       --missing=<missing-action>
258           A debug option to help with future "partial clone" development.
259           This option specifies how missing objects are handled.
260
261           The form --missing=error requests that pack-objects stop with an
262           error if a missing object is encountered. If the repository is a
263           partial clone, an attempt to fetch missing objects will be made
264           before declaring them missing. This is the default action.
265
266           The form --missing=allow-any will allow object traversal to
267           continue if a missing object is encountered. No fetch of a missing
268           object will occur. Missing objects will silently be omitted from
269           the results.
270
271           The form --missing=allow-promisor is like allow-any, but will only
272           allow object traversal to continue for EXPECTED promisor missing
273           objects. No fetch of a missing object will occur. An unexpected
274           missing object will raise an error.
275
276       --exclude-promisor-objects
277           Omit objects that are known to be in the promisor remote. (This
278           option has the purpose of operating only on locally created
279           objects, so that when we repack, we still maintain a distinction
280           between locally created objects [without .promisor] and objects
281           from the promisor remote [with .promisor].) This is used with
282           partial clone.
283
284       --keep-unreachable
285           Objects unreachable from the refs in packs named with --unpacked=
286           option are added to the resulting pack, in addition to the
287           reachable objects that are not in packs marked with *.keep files.
288           This implies --revs.
289
290       --pack-loose-unreachable
291           Pack unreachable loose objects (and their loose counterparts
292           removed). This implies --revs.
293
294       --unpack-unreachable
295           Keep unreachable objects in loose form. This implies --revs.
296
297       --delta-islands
298           Restrict delta matches based on "islands". See DELTA ISLANDS below.
299

DELTA ISLANDS

301       When possible, pack-objects tries to reuse existing on-disk deltas to
302       avoid having to search for new ones on the fly. This is an important
303       optimization for serving fetches, because it means the server can avoid
304       inflating most objects at all and just send the bytes directly from
305       disk. This optimization can’t work when an object is stored as a delta
306       against a base which the receiver does not have (and which we are not
307       already sending). In that case the server "breaks" the delta and has to
308       find a new one, which has a high CPU cost. Therefore it’s important for
309       performance that the set of objects in on-disk delta relationships
310       match what a client would fetch.
311
312       In a normal repository, this tends to work automatically. The objects
313       are mostly reachable from the branches and tags, and that’s what
314       clients fetch. Any deltas we find on the server are likely to be
315       between objects the client has or will have.
316
317       But in some repository setups, you may have several related but
318       separate groups of ref tips, with clients tending to fetch those groups
319       independently. For example, imagine that you are hosting several
320       "forks" of a repository in a single shared object store, and letting
321       clients view them as separate repositories through GIT_NAMESPACE or
322       separate repos using the alternates mechanism. A naive repack may find
323       that the optimal delta for an object is against a base that is only
324       found in another fork. But when a client fetches, they will not have
325       the base object, and we’ll have to find a new delta on the fly.
326
327       A similar situation may exist if you have many refs outside of
328       refs/heads/ and refs/tags/ that point to related objects (e.g.,
329       refs/pull or refs/changes used by some hosting providers). By default,
330       clients fetch only heads and tags, and deltas against objects found
331       only in those other groups cannot be sent as-is.
332
333       Delta islands solve this problem by allowing you to group your refs
334       into distinct "islands". Pack-objects computes which objects are
335       reachable from which islands, and refuses to make a delta from an
336       object A against a base which is not present in all of A's islands.
337       This results in slightly larger packs (because we miss some delta
338       opportunities), but guarantees that a fetch of one island will not have
339       to recompute deltas on the fly due to crossing island boundaries.
340
341       When repacking with delta islands the delta window tends to get clogged
342       with candidates that are forbidden by the config. Repacking with a big
343       --window helps (and doesn’t take as long as it otherwise might because
344       we can reject some object pairs based on islands before doing any
345       computation on the content).
346
347       Islands are configured via the pack.island option, which can be
348       specified multiple times. Each value is a left-anchored regular
349       expressions matching refnames. For example:
350
351           [pack]
352           island = refs/heads/
353           island = refs/tags/
354
355       puts heads and tags into an island (whose name is the empty string; see
356       below for more on naming). Any refs which do not match those regular
357       expressions (e.g., refs/pull/123) is not in any island. Any object
358       which is reachable only from refs/pull/ (but not heads or tags) is
359       therefore not a candidate to be used as a base for refs/heads/.
360
361       Refs are grouped into islands based on their "names", and two regexes
362       that produce the same name are considered to be in the same island. The
363       names are computed from the regexes by concatenating any capture groups
364       from the regex, with a - dash in between. (And if there are no capture
365       groups, then the name is the empty string, as in the above example.)
366       This allows you to create arbitrary numbers of islands. Only up to 14
367       such capture groups are supported though.
368
369       For example, imagine you store the refs for each fork in
370       refs/virtual/ID, where ID is a numeric identifier. You might then
371       configure:
372
373           [pack]
374           island = refs/virtual/([0-9]+)/heads/
375           island = refs/virtual/([0-9]+)/tags/
376           island = refs/virtual/([0-9]+)/(pull)/
377
378       That puts the heads and tags for each fork in their own island (named
379       "1234" or similar), and the pull refs for each go into their own
380       "1234-pull".
381
382       Note that we pick a single island for each regex to go into, using
383       "last one wins" ordering (which allows repo-specific config to take
384       precedence over user-wide config, and so forth).
385

CONFIGURATION

387       Various configuration variables affect packing, see git-config(1)
388       (search for "pack" and "delta").
389
390       Notably, delta compression is not used on objects larger than the
391       core.bigFileThreshold configuration variable and on files with the
392       attribute delta set to false.
393

SEE ALSO

395       git-rev-list(1) git-repack(1) git-prune-packed(1)
396

GIT

398       Part of the git(1) suite
399
400
401
402Git 2.36.1                        2022-05-05               GIT-PACK-OBJECTS(1)
Impressum