git count-objects

Administration

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]
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Quick count

git count-objects -vH

Everything, in readable units.

Workflow Examples

1
git count-objects -v

Check count

2
git gc

Pack 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:

A clone receives one packfile; there are no loose objects yet.