git count-objects
Count objects and show how much disk space they use
The 'git count-objects' command reports how many loose objects the repository has and how much space they take; with -v it also shows packfiles and garbage. Useful to decide whether git gc would help, or to see how big a repository really is.
Synopsis
git count-objects [-v] [-H]Examples
Quick count
git count-objects -vHEverything, in readable units.
Workflow Examples
git count-objects -vCheck count
git gcPack if it is high
Troubleshooting
size-pack is huge
Cause: Large files in history
Find them with git rev-list --objects --all | git cat-file --batch-check
Tips & Pitfalls
Best Practices
- ✓Use -H for human-readable sizes.
FAQ
A clone receives one packfile; there are no loose objects yet.