Run git gc housekeeping and prune unreachable objects

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

Documented steps

  1. Run housekeeping manually with `git gc` — compresses revisions, removes unreachable objects, packs refs, prunes reflog/rerere and stale worktrees, and updates the commit-graph.
  2. Let Git decide whether maintenance is needed: `git gc --auto` (does nothing unless thresholds are exceeded: >6700 loose objects or >50 packs).
  3. Prune loose objects older than a date: `git gc --prune=<date>` (default 2 weeks; `--prune=now` prunes all regardless of age, with corruption risk).
  4. For a one-off deep optimization (rare) use `git gc --aggressive` — expensive and mostly-persistent; not recommended without benchmarks.
  5. Run asynchronously in the background with `git gc --detach` (or rely on gc.autoDetach, default true).
  6. Prefer the scheduled `git maintenance` framework for ongoing upkeep instead of ad-hoc gc.
  7. Official docs: https://git-scm.com/docs/git-gc

Known gotchas

Related routes

Run git gc housekeeping and prune unreachable objects
git-scm.com · 7 steps · unrated
Run housekeeping / garbage collection with git gc
git-scm.com · 5 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