Progress:
TIER 3 · MODULE 40· Expert

git show-index

Inspect what's inside a pack index.

🎯 What & why

git show-index dumps the contents of a packfile index (.idx) - object offset, SHA, and CRC for every object in the pack. It is pack forensics, nothing more.

🧠 Mental model

The .idx is a sorted lookup table into a .pack. show-index reads stdin and prints one line per object so you can see what is in there without rebuilding.

🛠️ Synopsis

git show-index [--object-format=<hash>] < <pack>.idx

Output (per line):
  <offset> <sha1> (<crc32>)

Note: reads the .idx on stdin, not as an argument.

🎚️ Switches & options

FlagWhat it does
< <pack>.idxPipe the .idx file in via stdin (no positional arg)
--object-format=<hash>Hash algorithm of the index: sha1 (default) or sha256

💡 Use cases

🧪 Examples

List all objects in a pack
git show-index < .git/objects/pack/pack-abcd1234.idx
Find one object's offset
git show-index < .git/objects/pack/pack-abcd1234.idx | grep <sha>
Count objects in a pack
git show-index < .git/objects/pack/pack-abcd1234.idx | wc -l
SHA-256 repo
git show-index --object-format=sha256 < .git/objects/pack/pack-xxxx.idx

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

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