Progress:
TIER 2 · MODULE 16· Intermediate

git count-objects

Loose objects, packs, sizes. Quick health check.

🎯 What & why

git count-objects reports how much disk Git is using — loose objects vs packed, garbage, and unreachables. The cheap first check before you reach for git gc or git repack.

🧠 Mental model

Inventory of .git/objects/. Without -v you get loose-object count and size; with -v you get the full breakdown including packs and what's preventing pruning.

🛠️ Synopsis

git count-objects [-v | --verbose] [-H | --human-readable]

🎚️ Switches & options

FlagWhat it does
`-v` / `--verbose`Full breakdown: count, size, in-pack, packs, size-pack, prune-packable, garbage, size-garbage.
`-H` / `--human-readable`Print sizes as KiB/MiB/GiB instead of raw KiB integers.

💡 Use cases

🧪 Examples

Quick loose-object glance
git count-objects
Full breakdown, human-readable
git count-objects -vH
After a gc, verify in-pack jumped
git gc && git count-objects -v
Watch a repack reduce loose count
git repack -ad && git count-objects -v

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

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