GIT-MULTI-PACK-INDEX(1)
π GIT-MULTI-PACK-INDEX π
okay bestie, so this is the git-multi-pack-index page from the git manual β it lives in section 1, and it's all about writing and verifying multi-pack-indexes. yes, the MIDX. the main character of pack management. let's get into it π«Ά
β¨ NAME β¨
git-multi-pack-index β write and verify multi-pack-indexes. that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
git multi-pack-index [<options>] write [--preferred-pack=<pack>]
[--[no-]bitmap] [--[no-]incremental] [--[no-]stdin-packs]
[--refs-snapshot=<path>] [--[no-]write-chain-file]
[--base=<checksum>]
git multi-pack-index [<options>] compact [--[no-]incremental]
[--[no-]bitmap] [--base=<checksum>] [--[no-]write-chain-file]
<from> <to>
git multi-pack-index [<options>] verify
git multi-pack-index [<options>] expire
git multi-pack-index [<options>] repack [--batch-size=<size>]
π¦ DESCRIPTION π¦
Write or verify a multi-pack-index (MIDX) file. literally that's the job. no cap. β¨
π OPTIONS π
These command-line options work across all the sub-commands, so jot these down once and you're set, bestie:
--object-dir=<dir>β use the directory you give here as the location for Git objects. we go check<dir>/packs/multi-pack-indexfor the current MIDX file, and<dir>/packsfor the pack-files we're gonna index.
heads up: <dir> must be an alternate of the current repository. that's a hard requirement, ngl.
--progress,--no-progressβ turn progress on/off explicitly. if you don't say either one, progress shows up when standard error is connected to a terminal. supported by thewrite,verify,expire, andrepacksub-commands. π«Ά
The following subcommands are available (aka the lineup π):
β write β
Write a new MIDX file. the options below are the write sub-command's little squad:
--preferred-pack=<pack>β when you specify this, ties get broken in favor of this pack when there are additional copies of its objects in other packs. ties for objects that aren't found in the preferred pack always get resolved in favor of the copy in the pack with the highest mtime. if you don't specify anything, the pack with the lowest mtime is the default. also: the preferred pack must have at least one object. non-negotiable π--[no-]bitmapβ control whether or not a multi-pack bitmap gets written. your call, bestie.--stdin-packsβ write a multi-pack index containing only the set of line-delimited pack index basenames you feed in over stdin. very curated. very exclusive. π--refs-snapshot=<path>β with--bitmap, you can optionally specify a file containing a "refs snapshot" taken prior to repacking.
a reference snapshot is composed of line-delimited OIDs corresponding to the reference tips, usually taken by git repack prior to generating a new pack. a line may optionally start with a + character to indicate that the reference which corresponds to that OID is "preferred" β peep git-config(1)'s pack.preferBitmapTips.
the file given at <path> is expected to be readable, and it can contain duplicates. (if a given OID shows up more than once, it's marked as preferred if at least one instance of it begins with the special + marker.) π
--incrementalβ write an incremental MIDX file containing only objects and packs not present in an existing MIDX layer. migrates non-incremental MIDXs to incremental ones when necessary. slay β¨--[no-]write-chain-fileβ when used with--incremental, write a new MIDX layer but do not update themulti-pack-index-chainfile. the checksum of the new layer gets printed to standard output, so the caller can assemble and write the chain itself. requires--incremental. (this is the DIY option, lowkey iconic)--base=<checksum>β specify the checksum of an existing MIDX layer to use as the base when writing a new incremental layer. the special valuenoneindicates the new layer should have no base (i.e., it becomes a root layer). requires--no-write-chain-file. π
π« compact π«
Write a new MIDX layer containing only objects and packs present in the range <from> to <to>, where both arguments are checksums of existing layers in the MIDX chain.
--incrementalβ write the result to a MIDX chain instead of writing a stand-alone MIDX.--[no-]bitmapβ control whether or not a multi-pack bitmap gets written.--[no-]write-chain-fileβ when used with--incremental, write a new compacted MIDX layer but do not update themulti-pack-index-chainfile. the checksum of the new layer is printed to standard output. requires--incremental.--base=<checksum>β specify the checksum of an existing MIDX layer to use as the base for the compacted result, instead of using the immediate parent of<from>. the special valuenoneindicates the result should have no base.
β οΈ note that the compact command requires writing a version-2 midx that cannot be read by versions of Git prior to v2.54. so like, if your friends are on ancient git, they're not gonna see your compacted result. π
π§ verify π§
Verify the contents of the MIDX file. vibe check for your index π
πΈ expire πΈ
Delete the pack-files that are tracked by the MIDX file, but have no objects referenced by the MIDX (with the exception of .keep packs and cruft packs). rewrite the MIDX file afterward to remove all references to these pack-files. basically clearing out the clutter, we love a clean slate β¨
π Note: this mode is incompatible with incremental MIDX files. like, don't even try it.
π repack π
Create a new pack-file containing objects in small pack-files referenced by the multi-pack-index.
if the size given by the --batch-size=<size> argument is zero, then create a pack containing all objects referenced by the multi-pack-index. for a non-zero batch size, select the pack-files by examining packs from oldest-to-newest, computing the "expected size" by counting the number of objects in the pack referenced by the multi-pack-index, then divide by the total number of objects in the pack and multiply by the pack size. we select packs with expected size below the batch size until the set of packs have total expected size at least the batch size, or all pack-files are considered. if only one pack-file is selected, then do nothing. if a new pack-file is created, rewrite the multi-pack-index to reference the new pack-file. a later run of git multi-pack-index expire will delete the pack-files that were part of this batch. fr fr, that's the whole flow π«Ά
if repack.packKeptObjects is false, then any pack-files with an associated .keep file will not be selected for the batch to repack.
π Note: this mode is incompatible with incremental MIDX files. same deal as expire, bestie.
π EXAMPLES π
- Write a MIDX file for the packfiles in the current
.gitdirectory.
$ git multi-pack-index write
- Write a MIDX file for the packfiles in the current
.gitdirectory with a corresponding bitmap.
$ git multi-pack-index write --preferred-pack=<pack> --bitmap
- Write a MIDX file for the packfiles in an alternate object store.
$ git multi-pack-index --object-dir <alt> write
- Verify the MIDX file for the packfiles in the current
.gitdirectory.
$ git multi-pack-index verify
π SEE ALSO π
go read The Multi-Pack-Index Design Document[1] and gitformat-pack(5) if you want more info on the multi-pack-index feature and its file format. iykyk π
π GIT π
Part of the git(1) suite. obviously. family ties β¨
π¦ NOTES π¦
- The Multi-Pack-Index Design Document
file:///usr/share/doc/git-doc/technical/multi-pack-index.html
and that's the page, bestie!! π«Ά this whole thing ships with Git 2.56.0, dated 2026-09-27 β go forth and index your packs, you absolute icon π ππ
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms