Estimate total Git repository size including history, objects and packfiles.
A repository's on-disk footprint is the sum of its .git directory (loose objects awaiting packing, compressed packfiles holding history, and any Git LFS content) plus the working tree of checked-out files. Formula: total = loose_objects + packfiles + lfs_objects + working_tree. A high .git-to-working-tree ratio usually signals deep history or large binaries that were committed directly instead of through LFS.
total_repo_MB = loose_objects + packfiles + lfs_objects + working_tree
Every version of every file you've ever committed still lives in .git's history, even after deletion. Large binaries, generated files, or media committed directly (instead of via LFS) accumulate across commits and bloat the packfile.
Run `git count-objects -v` — it reports loose object count/size and, after a `git gc`, the packed size. `du -sh .git` gives the total directory size.
Yes — LFS stores pointers (a few bytes) in Git history and keeps actual large file content in separate LFS storage, so .git/objects and packfiles stay small even as binary history grows.
Run `git gc --aggressive` to repack loose objects, or use `git filter-repo`/BFG Repo-Cleaner to rewrite history and remove large blobs, followed by a fresh clone to reclaim disk space.