Git Packfiles and Maintenance: Measure Before Tuning
Loose objects and packs
Git can store individual compressed objects or collect objects into packfiles with indexes for lookup. Similar objects may be represented as deltas to save space. Packing changes storage representation, not the logical commit ID or its tree. The fixture starts with two commits and six loose objects.
Read the evidence
count is the number of loose objects; in-pack is the number in packs; packs counts packfiles; size and size-pack are disk-use measures in KiB unless human-readable mode is selected. Packed and loose copies can overlap, so their counts are not necessarily the number of distinct objects. Measure a representative repository and task before choosing a tuning change.
A controlled packing experiment
Only in the new disposable packing repository, the lab runs a repack of all reachable objects and removes redundant packed copies. It observes six loose objects before and six packed objects afterward, with the same commit IDs and file bytes. Do not generalize the size improvement to large repositories; no timing or network benchmark was performed.
git count-objects -vgit repack -a -dgit count-objects -vgit log --onelinegit status --shortMaintenance and recovery boundaries
Maintenance can optimize storage and indexes, and some tasks can expire reflogs or remove unreachable objects. Coordinate with other writers, retain independent backups, and avoid aggressive pruning during recovery. git maintenance start can register background scheduling; it is not executed here. No garbage collection, expiration or scheduled maintenance is tested. A packfile is not a backup, and packing cannot turn a Git LFS pointer into its payload.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Git Packfiles and Maintenance: Measure Before Tuning — knowledge check
Distinguish storage, history, working tree and maintenance costs.
What does count mean in git count-objects -v?
What did packing change in the fixture?
Why not add loose and packed counts to get unique objects?
What should precede real maintenance tuning?
Does a packfile replace an independent backup?