Progress:
TIER 3 · MODULE 44· Expert

git verify-pack

Use after a suspicious push/clone to confirm sanity.

🎯 What & why

git verify-pack walks a packfile via its index and confirms each object's checksum and chain. Run it after a suspicious push, clone, or disk scare to prove the pack is intact.

🧠 Mental model

Reads pack-XXXX.idx, then re-checksums every object in pack-XXXX.pack, following delta chains. If anything mismatches, it errors. With -v, it prints per-object size, type, and chain depth.

🛠️ Synopsis

git verify-pack [-v|--verbose] [-s|--stat-only] <pack>.idx ...

🎚️ Switches & options

FlagWhat it does
<pack>.idxRequired: path to the .idx file (the .pack must sit beside it).
-v, --verbosePrint one line per object: SHA, type, size, offset, depth, base.
-s, --stat-onlyPrint only the summary (counts, deltas, chain depth) - no per-object output.
(no flag)Verify silently; exit 0 on success, non-zero on corruption.

💡 Use cases

🧪 Examples

Silent integrity check
git verify-pack .git/objects/pack/pack-abcd1234.idx
Just the summary numbers
git verify-pack -s .git/objects/pack/pack-abcd1234.idx
Per-object dump for analysis
git verify-pack -v .git/objects/pack/pack-abcd1234.idx | head
Find the deepest delta chains
git verify-pack -v .git/objects/pack/*.idx | awk '$5 ~ /^[0-9]+$/ {print $5}' | sort -n | tail

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.