git-pack-redundant
Remove redundant pack files for space optimization
SYNOPSIS
git pack-redundant [--verbose | --quiet] [--alt-odb] <--all | --index-file=<file> [--index-file=<file> ...] | --pack-directory=<dir> [--pack-directory=<dir> ...]>
PARAMETERS
--all
Scan all pack index files in the default $GIT_OBJECT_DIRECTORY.
--index-file=<file>
Specify one or more pack index files (.idx) to scan.
--pack-directory=<dir>
Scan all pack index files in the given directory.
--alt-odb
Also scan packfiles in alternate object databases.
--verbose, -v
Enable verbose output during scanning.
--quiet, -q
Suppress non-essential output.
DESCRIPTION
git pack-redundant is a Git plumbing command used to detect redundant packfiles in a repository's object store. Packfiles store compressed Git objects, and redundancy occurs when all objects in one packfile are fully contained within other packfiles.
This tool builds an in-memory bitmap of all objects across specified pack index files, then checks each packfile individually to determine if its entire content set is a subset of the others. It outputs the paths to redundant .idx files (one per line), which can guide cleanup efforts like repacking.
Primarily useful for repository maintenance, it helps optimize storage by identifying packs safe to remove after git repack. It does not delete files or verify pack integrity—pair with git-verify-pack or git fsck for safety. Run it on .git/objects/pack directories to list redundancies before pruning.
CAVEATS
Does not delete files or check pack integrity; use with git fsck. Requires at least two packs for redundancy detection. Memory-intensive for large repositories.
OUTPUT FORMAT
Prints absolute paths to redundant .idx files, one per line. Exit code 0 if redundancies found, 1 otherwise.
USAGE EXAMPLE
git pack-redundant --all --verbose
Lists verbose scan results for all packs.
HISTORY
Introduced in Git 1.4.4.8 (June 2007) as a maintenance tool. Enhanced in later versions (e.g., 1.6+) with --alt-odb and multi-file support for better handling of complex object stores.
SEE ALSO
git-repack(1), git-prune-packed(1), git-verify-pack(1), git-fsck(1)


