Measuring the Real Problem
du -sh .git
git count-objects -vH
A real, direct measurement of exactly how much of the repository's real size is already-committed object data — including the binary asset that will only grow every time it is replaced.
The Real LFS Configuration
*.bin filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
A real .gitattributes entry a team commits once — telling git (once LFS is installed) to treat matching files specially: store a real, tiny pointer in git's own history, and hand the actual bytes to LFS instead.
Where This Sandbox's Real Tooling Stops
which git-lfs
# (nothing — confirmed directly, not installed here)
On a real machine with git-lfs installed, the remaining real steps are: git lfs install (once, registers the filter), git lfs track "*.bin" (writes the same .gitattributes line automatically), and git lfs migrate import --include="*.bin" (rewrites history so already-committed binaries become real pointers too). This sandbox can commit the real .gitattributes text — the same reference of exactly what to commit — just not run the LFS binary itself to activate it.
product-photo.bin is a real, sizeable binary asset, already committed straight into history. Every future real clone of this repository downloads it — and every future revision of it, if it is ever replaced, since plain git keeps every version of every blob forever. Git LFS solves this real problem by storing a real, tiny pointer file in git's own history instead of the actual binary content, keeping the real bytes on a separate LFS server that only downloads what a given checkout actually needs.
An honest note, confirmed directly: this particular sandbox's minimal Buildroot image does not have the real git-lfs binary installed — only plain git. This lab still does everything real that does not require it: measuring the real bloat, and writing the real .gitattributes configuration a team would commit. Running git lfs install and git lfs migrate import to actually activate the filter is real, standard, one-time setup on any machine that has the tool — just not directly runnable here.
git count-objects -vH
Reports real, human-readable totals for the object database's size. Confirmed directly in this lab: the real binary asset's own committed size was directly visible in the total.
LFS pointer file
What plain git actually stores in history once LFS is active — a tiny real text file naming the actual content's hash and size, with the real bytes kept on a separate LFS server. Confirmed directly in this lab (by its absence): without git-lfs installed, .gitattributes alone does not create pointer files — the real binary stays committed exactly as-is.
Takeaways
- git count-objects -vH and du -sh .git directly measure how much a repository's object database actually costs
- The real .gitattributes filter=lfs declaration is the same configuration git lfs track would write automatically
- LFS works by storing a tiny real pointer file in git's history instead of the actual binary content
- Activating LFS for real needs the git-lfs binary itself (git lfs install, then track/migrate) — a real, one-time setup this specific sandbox cannot run, confirmed directly rather than faked