]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-repack.txt
Merge branch 'en/fetch-negotiation-default-fix'
[thirdparty/git.git] / Documentation / git-repack.txt
1 git-repack(1)
2 =============
3
4 NAME
5 ----
6 git-repack - Pack unpacked objects in a repository
7
8
9 SYNOPSIS
10 --------
11 [verse]
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]
13
14 DESCRIPTION
15 -----------
16
17 This command is used to combine all objects that do not currently
18 reside in a "pack", into a pack. It can also be used to re-organize
19 existing packs into a single, more efficient pack.
20
21 A pack is a collection of objects, individually compressed, with
22 delta compression applied, stored in a single file, with an
23 associated index file.
24
25 Packs are used to reduce the load on mirror systems, backup
26 engines, disk storage, etc.
27
28 OPTIONS
29 -------
30
31 -a::
32 Instead of incrementally packing the unpacked objects,
33 pack everything referenced into a single pack.
34 Especially useful when packing a repository that is used
35 for private development. Use
36 with `-d`. This will clean up the objects that `git prune`
37 leaves behind, but `git fsck --full --dangling` shows as
38 dangling.
39 +
40 Note that users fetching over dumb protocols will have to fetch the
41 whole new pack in order to get any contained object, no matter how many
42 other objects in that pack they already have locally.
43 +
44 Promisor packfiles are repacked separately: if there are packfiles that
45 have an associated ".promisor" file, these packfiles will be repacked
46 into another separate pack, and an empty ".promisor" file corresponding
47 to the new separate pack will be written.
48
49 -A::
50 Same as `-a`, unless `-d` is used. Then any unreachable
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
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
58 with the next 'git gc' invocation. See linkgit:git-gc[1].
59
60 -d::
61 After packing, if the newly created packs make some
62 existing packs redundant, remove the redundant packs.
63 Also run 'git prune-packed' to remove redundant
64 loose object files.
65
66 -l::
67 Pass the `--local` option to 'git pack-objects'. See
68 linkgit:git-pack-objects[1].
69
70 -f::
71 Pass the `--no-reuse-delta` option to `git-pack-objects`, see
72 linkgit:git-pack-objects[1].
73
74 -F::
75 Pass the `--no-reuse-object` option to `git-pack-objects`, see
76 linkgit:git-pack-objects[1].
77
78 -q::
79 --quiet::
80 Show no progress over the standard error stream and pass the `-q`
81 option to 'git pack-objects'. See linkgit:git-pack-objects[1].
82
83 -n::
84 Do not update the server information with
85 'git update-server-info'. This option skips
86 updating local catalog files needed to publish
87 this repository (or a direct copy of it)
88 over HTTP or FTP. See linkgit:git-update-server-info[1].
89
90 --window=<n>::
91 --depth=<n>::
92 These two options affect how the objects contained in the pack are
93 stored using delta compression. The objects are first internally
94 sorted by type, size and optionally names and compared against the
95 other objects within `--window` to see if using delta compression saves
96 space. `--depth` limits the maximum delta depth; making it too deep
97 affects the performance on the unpacker side, because delta data needs
98 to be applied that many times to get to the necessary object.
99 +
100 The default value for --window is 10 and --depth is 50. The maximum
101 depth is 4095.
102
103 --threads=<n>::
104 This option is passed through to `git pack-objects`.
105
106 --window-memory=<n>::
107 This option provides an additional limit on top of `--window`;
108 the window size will dynamically scale down so as to not take
109 up more than '<n>' bytes in memory. This is useful in
110 repositories with a mix of large and small objects to not run
111 out of memory with a large window, but still be able to take
112 advantage of the large window for the smaller objects. The
113 size can be suffixed with "k", "m", or "g".
114 `--window-memory=0` makes memory usage unlimited. The default
115 is taken from the `pack.windowMemory` configuration variable.
116 Note that the actual memory usage will be the limit multiplied
117 by the number of threads used by linkgit:git-pack-objects[1].
118
119 --max-pack-size=<n>::
120 Maximum size of each output pack file. The size can be suffixed with
121 "k", "m", or "g". The minimum size allowed is limited to 1 MiB.
122 If specified, multiple packfiles may be created, which also
123 prevents the creation of a bitmap index.
124 The default is unlimited, unless the config variable
125 `pack.packSizeLimit` is set. Note that this option may result in
126 a larger and slower repository; see the discussion in
127 `pack.packSizeLimit`.
128
129 -b::
130 --write-bitmap-index::
131 Write a reachability bitmap index as part of the repack. This
132 only makes sense when used with `-a`, `-A` or `-m`, as the bitmaps
133 must be able to refer to all reachable objects. This option
134 overrides the setting of `repack.writeBitmaps`. This option
135 has no effect if multiple packfiles are created, unless writing a
136 MIDX (in which case a multi-pack bitmap is created).
137
138 --pack-kept-objects::
139 Include objects in `.keep` files when repacking. Note that we
140 still do not delete `.keep` packs after `pack-objects` finishes.
141 This means that we may duplicate objects, but this makes the
142 option safe to use when there are concurrent pushes or fetches.
143 This option is generally only useful if you are writing bitmaps
144 with `-b` or `repack.writeBitmaps`, as it ensures that the
145 bitmapped packfile has the necessary objects.
146
147 --keep-pack=<pack-name>::
148 Exclude the given pack from repacking. This is the equivalent
149 of having `.keep` file on the pack. `<pack-name>` is the
150 pack file name without leading directory (e.g. `pack-123.pack`).
151 The option could be specified multiple times to keep multiple
152 packs.
153
154 --unpack-unreachable=<when>::
155 When loosening unreachable objects, do not bother loosening any
156 objects older than `<when>`. This can be used to optimize out
157 the write of any objects that would be immediately pruned by
158 a follow-up `git prune`.
159
160 -k::
161 --keep-unreachable::
162 When used with `-ad`, any unreachable objects from existing
163 packs will be appended to the end of the packfile instead of
164 being removed. In addition, any unreachable loose objects will
165 be packed (and their loose counterparts removed).
166
167 -i::
168 --delta-islands::
169 Pass the `--delta-islands` option to `git-pack-objects`, see
170 linkgit:git-pack-objects[1].
171
172 -g=<factor>::
173 --geometric=<factor>::
174 Arrange resulting pack structure so that each successive pack
175 contains at least `<factor>` times the number of objects as the
176 next-largest pack.
177 +
178 `git repack` ensures this by determining a "cut" of packfiles that need
179 to be repacked into one in order to ensure a geometric progression. It
180 picks the smallest set of packfiles such that as many of the larger
181 packfiles (by count of objects contained in that pack) may be left
182 intact.
183 +
184 Unlike other repack modes, the set of objects to pack is determined
185 uniquely by the set of packs being "rolled-up"; in other words, the
186 packs determined to need to be combined in order to restore a geometric
187 progression.
188 +
189 When `--unpacked` is specified, loose objects are implicitly included in
190 this "roll-up", without respect to their reachability. This is subject
191 to change in the future. This option (implying a drastically different
192 repack mode) is not guaranteed to work with all other combinations of
193 option to `git repack`.
194 +
195 When writing a multi-pack bitmap, `git repack` selects the largest resulting
196 pack as the preferred pack for object selection by the MIDX (see
197 linkgit:git-multi-pack-index[1]).
198
199 -m::
200 --write-midx::
201 Write a multi-pack index (see linkgit:git-multi-pack-index[1])
202 containing the non-redundant packs.
203
204 CONFIGURATION
205 -------------
206
207 Various configuration variables affect packing, see
208 linkgit:git-config[1] (search for "pack" and "delta").
209
210 By default, the command passes `--delta-base-offset` option to
211 'git pack-objects'; this typically results in slightly smaller packs,
212 but the generated packs are incompatible with versions of Git older than
213 version 1.4.4. If you need to share your repository with such ancient Git
214 versions, either directly or via the dumb http protocol, then you
215 need to set the configuration variable `repack.UseDeltaBaseOffset` to
216 "false" and repack. Access from old Git versions over the native protocol
217 is unaffected by this option as the conversion is performed on the fly
218 as needed in that case.
219
220 Delta compression is not used on objects larger than the
221 `core.bigFileThreshold` configuration variable and on files with the
222 attribute `delta` set to false.
223
224 SEE ALSO
225 --------
226 linkgit:git-pack-objects[1]
227 linkgit:git-prune-packed[1]
228
229 GIT
230 ---
231 Part of the linkgit:git[1] suite