Add a test showing that 'git repack' throws away grafted-away parents
[git/git.git] / Documentation / git-pack-objects.txt
1 git-pack-objects(1)
2 ===================
5 ----
6 git-pack-objects - Create a packed archive of objects
10 --------
11 [verse]
12 'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
13 [--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
14 [--revs [--unpacked | --all]*] [--stdout | base-name] < object-list
18 -----------
19 Reads list of objects from the standard input, and writes a packed
20 archive with specified base-name, or to the standard output.
22 A packed archive is an efficient way to transfer set of objects
23 between two repositories, and also is an archival format which
24 is efficient to access. The packed archive format (.pack) is
25 designed to be self contained so that it can be unpacked without
26 any further information, but for fast, random access to the objects
27 in the pack, a pack index file (.idx) will be generated.
29 Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or
30 any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES)
31 enables git to read from such an archive.
33 The 'git-unpack-objects' command can read the packed archive and
34 expand the objects contained in the pack into "one-file
35 one-object" format; this is typically done by the smart-pull
36 commands when a pack is created on-the-fly for efficient network
37 transport by their peers.
39 In a packed archive, an object is either stored as a compressed
40 whole, or as a difference from some other object. The latter is
41 often called a delta.
45 -------
46 base-name::
47 Write into a pair of files (.pack and .idx), using
48 <base-name> to determine the name of the created file.
49 When this option is used, the two files are written in
50 <base-name>-<SHA1>.{pack,idx} files. <SHA1> is a hash
51 of the sorted object names to make the resulting filename
52 based on the pack content, and written to the standard
53 output of the command.
55 --stdout::
56 Write the pack contents (what would have been written to
57 .pack file) out to the standard output.
59 --revs::
60 Read the revision arguments from the standard input, instead of
61 individual object names. The revision arguments are processed
62 the same way as 'git-rev-list' with the `--objects` flag
63 uses its `commit` arguments to build the list of objects it
64 outputs. The objects on the resulting list are packed.
66 --unpacked::
67 This implies `--revs`. When processing the list of
68 revision arguments read from the standard input, limit
69 the objects packed to those that are not already packed.
71 --all::
72 This implies `--revs`. In addition to the list of
73 revision arguments read from the standard input, pretend
74 as if all refs under `$GIT_DIR/refs` are specified to be
75 included.
77 --include-tag::
78 Include unasked-for annotated tags if the object they
79 reference was included in the resulting packfile. This
80 can be useful to send new tags to native git clients.
82 --window=[N]::
83 --depth=[N]::
84 These two options affect how the objects contained in
85 the pack are stored using delta compression. The
86 objects are first internally sorted by type, size and
87 optionally names and compared against the other objects
88 within --window to see if using delta compression saves
89 space. --depth limits the maximum delta depth; making
90 it too deep affects the performance on the unpacker
91 side, because delta data needs to be applied that many
92 times to get to the necessary object.
93 The default value for --window is 10 and --depth is 50.
95 --window-memory=[N]::
96 This option provides an additional limit on top of `--window`;
97 the window size will dynamically scale down so as to not take
98 up more than N bytes in memory. This is useful in
99 repositories with a mix of large and small objects to not run
100 out of memory with a large window, but still be able to take
101 advantage of the large window for the smaller objects. The
102 size can be suffixed with "k", "m", or "g".
103 `--window-memory=0` makes memory usage unlimited, which is the
104 default.
106 --max-pack-size=<n>::
107 Maximum size of each output packfile, expressed in MiB.
108 If specified, multiple packfiles may be created.
109 The default is unlimited, unless the config variable
110 `pack.packSizeLimit` is set.
112 --honor-pack-keep::
113 This flag causes an object already in a local pack that
114 has a .keep file to be ignored, even if it appears in the
115 standard input.
117 --incremental::
118 This flag causes an object already in a pack ignored
119 even if it appears in the standard input.
121 --local::
122 This flag is similar to `--incremental`; instead of
123 ignoring all packed objects, it only ignores objects
124 that are packed and/or not in the local object store
125 (i.e. borrowed from an alternate).
127 --non-empty::
128 Only create a packed archive if it would contain at
129 least one object.
131 --progress::
132 Progress status is reported on the standard error stream
133 by default when it is attached to a terminal, unless -q
134 is specified. This flag forces progress status even if
135 the standard error stream is not directed to a terminal.
137 --all-progress::
138 When --stdout is specified then progress report is
139 displayed during the object count and deltification phases
140 but inhibited during the write-out phase. The reason is
141 that in some cases the output stream is directly linked
142 to another command which may wish to display progress
143 status of its own as it processes incoming pack data.
144 This flag is like --progress except that it forces progress
145 report for the write-out phase as well even if --stdout is
146 used.
148 -q::
149 This flag makes the command not to report its progress
150 on the standard error stream.
152 --no-reuse-delta::
153 When creating a packed archive in a repository that
154 has existing packs, the command reuses existing deltas.
155 This sometimes results in a slightly suboptimal pack.
156 This flag tells the command not to reuse existing deltas
157 but compute them from scratch.
159 --no-reuse-object::
160 This flag tells the command not to reuse existing object data at all,
161 including non deltified object, forcing recompression of everything.
162 This implies --no-reuse-delta. Useful only in the obscure case where
163 wholesale enforcement of a different compression level on the
164 packed data is desired.
166 --compression=[N]::
167 Specifies compression level for newly-compressed data in the
168 generated pack. If not specified, pack compression level is
169 determined first by pack.compression, then by core.compression,
170 and defaults to -1, the zlib default, if neither is set.
171 Add --no-reuse-object if you want to force a uniform compression
172 level on all data no matter the source.
174 --delta-base-offset::
175 A packed archive can express base object of a delta as
176 either 20-byte object name or as an offset in the
177 stream, but older version of git does not understand the
178 latter. By default, 'git-pack-objects' only uses the
179 former format for better compatibility. This option
180 allows the command to use the latter format for
181 compactness. Depending on the average delta chain
182 length, this option typically shrinks the resulting
183 packfile by 3-5 per-cent.
185 --threads=<n>::
186 Specifies the number of threads to spawn when searching for best
187 delta matches. This requires that pack-objects be compiled with
188 pthreads otherwise this option is ignored with a warning.
189 This is meant to reduce packing time on multiprocessor machines.
190 The required amount of memory for the delta search window is
191 however multiplied by the number of threads.
192 Specifying 0 will cause git to auto-detect the number of CPU's
193 and set the number of threads accordingly.
195 --index-version=<version>[,<offset>]::
196 This is intended to be used by the test suite only. It allows
197 to force the version for the generated pack index, and to force
198 64-bit index entries on objects located above the given offset.
201 Author
202 ------
203 Written by Linus Torvalds <>
205 Documentation
206 -------------
207 Documentation by Junio C Hamano
210 --------
211 linkgit:git-rev-list[1]
212 linkgit:git-repack[1]
213 linkgit:git-prune-packed[1]
215 GIT
216 ---
217 Part of the linkgit:git[1] suite