Mac storage basics · Developer tools

How do I make a large Git repository use less space?

Short answer: Run git gc, prune stale branches, and preview untracked junk with git clean -n before removing it. Large committed binaries stay in history unless moved to Git LFS.

Start with housekeeping: git gc packs and cleans up the repository's objects, and git remote prune origin plus deleting merged branches removes leftovers. git clean -n previews untracked files (build output, logs) you could remove with git clean -f.

If large binary files are committed, the history keeps them; moving them to Git LFS or rewriting history is a bigger, team-level decision. For old projects you just want to keep, archive the whole folder to an external drive.

Last reviewed

Also available as Markdown and JSON.