Run housekeeping / garbage collection with git gc

domain: git-scm.com · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Routine optimization: `git gc` (compresses revisions, removes unreachable objects, packs refs).
  2. Only run if needed: `git gc --auto` — checks heuristics and exits immediately if nothing is overdue.
  3. Aggressive repack (rarely worth it, much slower): `git gc --aggressive`.
  4. Force a run even if another gc is active: `git gc --force`.
  5. Control how old loose objects get pruned: `git gc --prune=now` (increases risk if another process writes concurrently) or `--no-prune`.

Known gotchas

Related routes

Run git gc housekeeping and prune unreachable objects
git-scm.com · 7 steps · unrated
Run git gc housekeeping and prune unreachable objects
git-scm.com · 7 steps · unrated

Give your agent this knowledge — and 17,000+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans