git maintenance
Run or schedule background repository maintenance
The 'git maintenance' command runs optimization tasks (prefetching from remotes, packing loose objects, updating the commit-graph) and can register the repository to have them run in the background on a schedule. It keeps large repositories fast without blocking your commands.
Synopsis
git maintenance run [--task=<task>]
git maintenance start
git maintenance stop
git maintenance registerExamples
Enable scheduled maintenance
git maintenance startRegisters the repository and schedules tasks.
Run now
git maintenance runRun the configured tasks once.
Workflow Examples
git maintenance startSchedule tasks
git config core.fsmonitor trueOptionally, watch files for faster status
Troubleshooting
maintenance start fails
Cause: No system scheduler available
Run git maintenance run from your own scheduled job
Tips & Pitfalls
Best Practices
- ✓Use it on large or frequently fetched repositories.
FAQ
Fetches remotes into refs/prefetch/ in the background, so your git fetch is fast.