Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-repack.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-repack.adoc` 367 lines ยท 15015 bytes Raw Blame History 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] 13 [--window=] [--depth=] [--threads=] [--keep-pack=] 14 [--write-midx[=]] [--name-hash-version=] [--path-walk] 15 [--filter=] [--drop-filtered [--dry-run]] 16 17 DESCRIPTION 18 ----------- 19 20 This command is used to combine all objects that do not currently 21 reside in a "pack", into a pack. It can also be used to re-organize 22 existing packs into a single, more efficient pack. 23 24 A pack is a collection of objects, individually compressed, with 25 delta compression applied, stored in a single file, with an 26 associated index file. 27 28 Packs are used to reduce the load on mirror systems, backup 29 engines, disk storage, etc. 30 31 OPTIONS 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 + 43 Note that users fetching over dumb protocols will have to fetch the 44 whole new pack in order to get any contained object, no matter how many 45 other objects in that pack they already have locally. 46 + 47 Promisor packfiles are repacked separately: if there are packfiles that 48 have an associated ".promisor" file, these packfiles will be repacked 49 into another separate pack, and an empty ".promisor" file corresponding 50 to 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=:: 76 Expire unreachable objects older than `` 77 immediately instead of waiting for the next `git gc` invocation. 78 Only useful with `--cruft -d`. 79 80 --max-cruft-size=:: 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=:: 86 When generating cruft packs without pruning, only repack 87 existing cruft packs whose size is strictly less than `` 88 bytes, which can optionally 89 be suffixed with "k", "m", or "g". Cruft packs whose size is 90 greater than or equal to `` 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=:: 95 Write a cruft pack containing pruned objects (if any) to the 96 directory ``. 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=:: 125 --depth=:: 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 + 134 The default value for --window is 10 and --depth is 50. The maximum 135 depth is 4095. 136 137 --threads=:: 138 This option is passed through to `git pack-objects`. 139 140 --window-memory=:: 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 '' 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=:: 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=:: 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 `` forms. 174 175 --filter-to=:: 176 Write the pack containing filtered out objects to the 177 directory ``. 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 + 194 Only large blobs are supported for now, so `--filter=blob:limit=` 195 is currently the only accepted filter. Because dropped objects must be 196 recoverable, this option requires a promisor remote to be configured 197 and refuses to run otherwise. 198 + 199 This option requires `-a`, and implies `-d`: the objects are dropped by 200 rebuilding the promisor pack without them and then removing the now 201 redundant old packs, so the redundant packs must be deleted for the 202 space to actually be reclaimed. It is incompatible with `--filter-to` 203 and with bitmap writing (`-b`/`--write-bitmap-index`), since filtering 204 breaks the single-pack closure that bitmaps require. A bitmap setting 205 coming from configuration is silently disabled for the duration of the 206 command. 207 + 208 As 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 211 avoid a surprising network fetch mid-operation, and refuses to drop any 212 blob that the current index references, since such a blob would only be 213 lazily re-fetched by the next command that inspects the working tree. 214 These checks are skipped in bare repositories, which have neither a 215 working 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=:: 241 Exclude the given pack from repacking. This is the equivalent 242 of having `.keep` file on the pack. `` 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=:: 248 When loosening unreachable objects, do not bother loosening any 249 objects older than ``. 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:: 266 --geometric=:: 267 Arrange resulting pack structure so that each successive pack 268 contains at least `` 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 272 to be repacked into one in order to ensure a geometric progression. It 273 picks the smallest set of packfiles such that as many of the larger 274 packfiles (by count of objects contained in that pack) may be left 275 intact. 276 + 277 Unlike other repack modes, the set of objects to pack is determined 278 uniquely by the set of packs being "rolled-up"; in other words, the 279 packs determined to need to be combined in order to restore a geometric 280 progression. 281 + 282 Loose objects are implicitly included in this "roll-up", without respect to 283 their reachability. This is subject to change in the future. 284 + 285 When writing a multi-pack bitmap, `git repack` selects the largest resulting 286 pack as the preferred pack for object selection by the MIDX (see 287 linkgit:git-multi-pack-index[1]). 288 289 -m:: 290 --write-midx[=]:: 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 + 305 Without `--geometric`, a new MIDX layer is appended to the existing 306 chain (or a new chain is started) containing whatever packs were written 307 by the repack. Existing layers are preserved as-is. 308 + 309 When combined with `--geometric`, the incremental mode maintains a chain 310 of MIDX layers that is compacted over time using a geometric merging 311 strategy. Each repack creates a new tip layer containing the newly 312 written pack(s). Adjacent layers are then merged whenever the newer 313 layer's object count exceeds `1/repack.midxSplitFactor` of the next 314 deeper layer's count. Layers that do not meet this condition are 315 retained as-is. 316 + 317 The result is that newer (tip) layers tend to contain many small packs 318 with relatively few objects, while older (deeper) layers contain fewer, 319 larger packs covering more objects. Because compaction is driven by the 320 tip of the chain, newer layers are also rewritten more frequently than 321 older ones, which are only touched when enough objects have accumulated 322 to justify merging into them. This keeps the total number of layers 323 logarithmic relative to the total number of objects. 324 + 325 Only packs in the tip MIDX layer are considered as candidates for the 326 geometric repack; packs in deeper layers are left untouched. If the tip 327 layer contains fewer packs than `repack.midxNewLayerThreshold`, those 328 packs are excluded from the geometry entirely, and a new layer is 329 created for any new pack(s) without disturbing the existing chain. 330 -- 331 332 --name-hash-version=:: 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 340 CONFIGURATION 341 ------------- 342 343 Various configuration variables affect packing, see 344 linkgit:git-config[1] (search for "pack" and "delta"). 345 346 By default, the command passes `--delta-base-offset` option to 347 'git pack-objects'; this typically results in slightly smaller packs, 348 but the generated packs are incompatible with versions of Git older than 349 version 1.4.4. If you need to share your repository with such ancient Git 350 versions, either directly or via the dumb http protocol, then you 351 need to set the configuration variable `repack.UseDeltaBaseOffset` to 352 "false" and repack. Access from old Git versions over the native protocol 353 is unaffected by this option as the conversion is performed on the fly 354 as needed in that case. 355 356 Delta compression is not used on objects larger than the 357 `core.bigFileThreshold` configuration variable and on files with the 358 attribute `delta` set to false. 359 360 SEE ALSO 361 -------- 362 linkgit:git-pack-objects[1] 363 linkgit:git-prune-packed[1] 364 365 GIT 366 --- 367 Part of the linkgit:git[1] suite