Git LFS keeps every version of every large file you have checked out, until you prune
Repositories with Git LFS store large file versions in .git/lfs. How to see how much each repo holds, and prune old versions without breaking anything.
Git LFS keeps large files, like game assets, models and media, outside normal Git history. On your Mac, each repository stores the versions it has downloaded in .git/lfs/objects. Switch branches and pull for a year, and old versions pile up.
# LFS storage in one repo
du -sh .git/lfs
# Across your projects
find ~/code ~/Projects ~/Developer -type d -path '*/.git/lfs' -prune -exec du -sh {} + 2>/dev/null | sort -hAdjust the folders to where you keep repositories.
Prune old versions
git lfs prune --dry-run --verbose
git lfs pruneThis deletes local copies of LFS files that are not needed by your current checkout or recent commits, and that are already on the server. It does not touch the remote.
Keep less going forward
# Only keep LFS files for recent history (days)
git config lfs.fetchrecentcommitsdays 3
git config lfs.pruneoffsetdays 1For repos you only need briefly, a shallow clone with GIT_LFS_SKIP_SMUDGE=1 fetches LFS files only when you ask. More on repositories: Git repositories taking up space.
Common questions
Where does Git LFS store files on a Mac?
Inside each repository, in .git/lfs/objects.
Is git lfs prune safe?
Yes. It only removes local copies of files not needed by your current checkout or recent history and already pushed. Run it with --dry-run first to see.
How do I stop Git LFS using so much space?
Run git lfs prune regularly and lower lfs.fetchrecentcommitsdays so fewer old versions are downloaded.