LinuxCommandLibrary

git-unpack-objects

Unpack Git objects from a packfile

SYNOPSIS

git unpack-objects [-q|--quiet] [--progress] [--no-progress] [--strict] [--keep-cache-objects] [--unpack-unreachable=<when>] [--max-input-size=<MiB>] [--thin] <pack-file>...

PARAMETERS

-q, --quiet
    Suppress progress reporting.

--progress
    Display progress meter.

-n, --no-progress
    Do not display progress meter.

--strict
    Die if packfile is malformed or exceeds max input size.

--keep-cache-objects
    Store non-commit objects in cache pack instead of loose.

--unpack-unreachable=<when>
    Unpack unreachable objects: never, immediate (default), or on-demand.

--max-input-size=<MiB>
    Maximum allowed packfile input size in MiB; die if exceeded.

--thin
    Handle thin packfiles (missing base objects).

DESCRIPTION

git unpack-objects is a low-level plumbing command that reads packed Git objects from one or more packfiles and unpacks them as loose objects into the .git/objects directory.

It decompresses zlib streams, resolves deltas using bases from the pack or existing objects, and writes each object with its SHA-1 filename.

Primarily used internally by commands like git fetch-pack, git receive-pack, and during git clone or git fetch to populate the object database from network-transferred packs. Supports thin packs (optimized transfers omitting redundant bases) and controls handling of unreachable objects.

The command processes pack data sequentially, validating integrity unless disabled. End users rarely invoke it directly, as it's designed for scripted, non-interactive use in Git's core protocols. It ensures repository consistency by unpacking only valid objects.

CAVEATS

Low-level command; direct use risks repository corruption. Requires write access to .git/objects. Not for interactive end-user invocation.

HISTORY

Introduced in early Git (v1.0, 2005) by Linus Torvalds as part of packfile support. Evolved with delta resolution, thin packs (v1.5+), and unreachable object handling for efficient transfers.

SEE ALSO

Copied to clipboard