git maintenance

Administration

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 register
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Enable scheduled maintenance

git maintenance start

Registers the repository and schedules tasks.


Run now

git maintenance run

Run the configured tasks once.

Workflow Examples

1
git maintenance start

Schedule tasks

2
git config core.fsmonitor true

Optionally, 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

A:

Fetches remotes into refs/prefetch/ in the background, so your git fetch is fast.