LinuxCommandLibrary

git-verify-pack

Verify the integrity of packfiles

TLDR

Verify a packed Git archive file

$ git verify-pack [path/to/pack-file]
copy

Verify a packed Git archive file and show verbose details
$ git verify-pack [[-v|--verbose]] [path/to/pack-file]
copy

Verify a packed Git archive file and only display the statistics
$ git verify-pack [[-s|--stat-only]] [path/to/pack-file]
copy

SYNOPSIS

git verify-pack [-v|--verbose] [-s|--stat-only] [-q|--quiet] [-f|--strict] [-t|--threads=<n>] <packfile> [.idx]

PARAMETERS

-v, --verbose
    Print detailed information about each verified object, including OID, type, sizes, offset, and delta base.

-s, --stat-only
    Skip full verification; print only pack statistics (total objects, sizes, delta usage).

-q, --quiet
    Suppress progress output; print only errors or stats.

-f, --strict
    Exit non-zero immediately on any detected error (default is warning).

-t, --threads=<n>
    Use <n> threads for parallel verification (default: 1).

DESCRIPTION

git-verify-pack is a low-level Git plumbing command for verifying the integrity of pack files, which efficiently store compressed and delta-encoded Git objects like blobs, trees, commits, and tags.

It performs comprehensive checks including:
• CRC32 checksum validation for each object's raw data in the pack.
• SHA-1 hash recomputation for fully reconstructed objects, comparing against expected object IDs (OIDs).
• Pack index (.idx) integrity if provided.

Designed for repository maintenance, it detects corruption early. Higher-level tools like git fsck invoke it automatically. Verbose mode outputs object details: OID, type, size, packed size, offset, and deltas. Statistics mode (-s) quickly reports totals without full verification, ideal for size audits. Multi-threading (-t) accelerates large-pack processing.

Primarily for administrators diagnosing issues in bare repositories or during backups. Exits zero on success; non-zero on errors unless -q suppresses output.

CAVEATS

Plumbing command, not for casual use—prefer git fsck. CPU-intensive on large packs without threads; requires read access to pack/.idx files.

INPUT FILES

Accepts packfile.pack or packfile.idx; automatically loads companion file if one specified.

EXAMPLE OUTPUT (VERBOSE)

c88c4dde2b7bf86805dcdba0154b691afb8b5150 commit 447 390 12 Lists: OID type size packed-size offset delta-base.

HISTORY

Introduced in Git 1.0.0 (2005) for pack validation; evolved with multi-threading in Git 2.9 (2016) and strict mode refinements.

SEE ALSO

Copied to clipboard