Add a test showing that 'git repack' throws away grafted-away parents
[git/git.git] / Documentation / git-pack-objects.txt
CommitLineData
5f40520f
JH
1git-pack-objects(1)
2===================
5f40520f
JH
3
4NAME
5----
7bd7f280 6git-pack-objects - Create a packed archive of objects
5f40520f
JH
7
8
9SYNOPSIS
10--------
ca5381d4 11[verse]
b1889c36 12'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
fa438a2e 13 [--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
4321134c 14 [--revs [--unpacked | --all]*] [--stdout | base-name] < object-list
5f40520f
JH
15
16
17DESCRIPTION
18-----------
19Reads list of objects from the standard input, and writes a packed
20archive with specified base-name, or to the standard output.
21
22A packed archive is an efficient way to transfer set of objects
23between two repositories, and also is an archival format which
24is efficient to access. The packed archive format (.pack) is
ba1333fe
PE
25designed to be self contained so that it can be unpacked without
26any further information, but for fast, random access to the objects
27in the pack, a pack index file (.idx) will be generated.
5f40520f 28
1e6ab5de
MK
29Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or
30any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES)
31enables git to read from such an archive.
32
ba020ef5 33The 'git-unpack-objects' command can read the packed archive and
5f40520f
JH
34expand the objects contained in the pack into "one-file
35one-object" format; this is typically done by the smart-pull
36commands when a pack is created on-the-fly for efficient network
37transport by their peers.
38
ca5381d4
JH
39In a packed archive, an object is either stored as a compressed
40whole, or as a difference from some other object. The latter is
41often called a delta.
42
5f40520f
JH
43
44OPTIONS
45-------
46base-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
e23ed9a8
NP
51 of the sorted object names to make the resulting filename
52 based on the pack content, and written to the standard
5f40520f
JH
53 output of the command.
54
55--stdout::
89438677 56 Write the pack contents (what would have been written to
5f40520f
JH
57 .pack file) out to the standard output.
58
4321134c
JH
59--revs::
60 Read the revision arguments from the standard input, instead of
61 individual object names. The revision arguments are processed
ba020ef5 62 the same way as 'git-rev-list' with the `--objects` flag
4321134c
JH
63 uses its `commit` arguments to build the list of objects it
64 outputs. The objects on the resulting list are packed.
65
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.
70
71--all::
72 This implies `--revs`. In addition to the list of
73 revision arguments read from the standard input, pretend
3df19671 74 as if all refs under `$GIT_DIR/refs` are specified to be
4321134c
JH
75 included.
76
f0a24aa5
SP
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.
81
3240240f
SB
82--window=[N]::
83--depth=[N]::
3df19671 84 These two options affect how the objects contained in
5f40520f
JH
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.
618e613a 93 The default value for --window is 10 and --depth is 50.
5f40520f 94
e93b15cd
BD
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.
105
6b94b1a0
DH
106--max-pack-size=<n>::
107 Maximum size of each output packfile, expressed in MiB.
108 If specified, multiple packfiles may be created.
2b84b5a8
JS
109 The default is unlimited, unless the config variable
110 `pack.packSizeLimit` is set.
6b94b1a0 111
e96fb9b8
BC
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.
116
5f40520f
JH
117--incremental::
118 This flag causes an object already in a pack ignored
119 even if it appears in the standard input.
120
12ea5bea
JH
121--local::
122 This flag is similar to `--incremental`; instead of
123 ignoring all packed objects, it only ignores objects
daae0625 124 that are packed and/or not in the local object store
12ea5bea 125 (i.e. borrowed from an alternate).
5f40520f 126
63ae26f8
NW
127--non-empty::
128 Only create a packed archive if it would contain at
129 least one object.
130
231f240b
NP
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.
136
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.
147
ca5381d4
JH
148-q::
149 This flag makes the command not to report its progress
150 on the standard error stream.
151
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.
158
fa736f72
NP
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.
960ccca6 162 This implies --no-reuse-delta. Useful only in the obscure case where
fa736f72
NP
163 wholesale enforcement of a different compression level on the
164 packed data is desired.
165
960ccca6
DH
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.
483bc4f0 171 Add --no-reuse-object if you want to force a uniform compression
05cc2ffc 172 level on all data no matter the source.
960ccca6 173
63fba759
JH
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
ba020ef5 178 latter. By default, 'git-pack-objects' only uses the
63fba759
JH
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.
184
367f4a43
NP
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.
833e3df1
AE
192 Specifying 0 will cause git to auto-detect the number of CPU's
193 and set the number of threads accordingly.
367f4a43 194
be18c1fe
NP
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.
199
ca5381d4 200
5f40520f
JH
201Author
202------
203Written by Linus Torvalds <torvalds@osdl.org>
204
205Documentation
206-------------
207Documentation by Junio C Hamano
208
56ae8df5 209SEE ALSO
e31bb3bb 210--------
5162e697
DM
211linkgit:git-rev-list[1]
212linkgit:git-repack[1]
213linkgit:git-prune-packed[1]
e31bb3bb 214
5f40520f
JH
215GIT
216---
9e1f0a85 217Part of the linkgit:git[1] suite