Files
Advanced-Git/contents/git-maintenance-start.md
2025-07-26 07:49:48 +00:00

2.0 KiB
Raw Permalink Blame History

⬅️ Back to Git Essentials & Hidden Gems

git maintenance start

Category: Maintenance

Runs a cronJob in background for the specified repo for periodic maintenance.

git maintenance start enables background maintenance tasks for your Git repository. It sets up scheduled jobs (using your systems scheduler, like cron on Unix or Task Scheduler on Windows) to automatically run Git maintenance commands at regular intervals. This keeps your repository fast and healthy by running tasks like garbage collection, commit-graph optimization, and cleanup operations in the background, so you dont have to remember to do it manually.

Command

git maintenance start

Examples

  • Enable background maintenance for your repository.
git maintenance start 
  • Run maintenance tasks every hour for more active repos.
git maintenance start --schedule=hourly 

Steps

  1. Run git maintenance start in your repository.
  2. Optionally, use --schedule=hourly or --schedule=daily to control how often maintenance runs.
  3. Git will now automatically run tasks like garbage collection, pruning unreachable objects, and optimizing internal data structures in the background.
  4. You can stop background maintenance with git maintenance stop if needed.

ProTips

Tip

Set up maintenance on large or long-lived repos to keep them fast and healthy.

Tip

Use with cron or scheduled tasks for automation.

Tip

If you notice Git getting slow, check if maintenance is enabled or run it manually.

➡️ See the Next Step: git request-pull


Author: mike-rambil • Updated: 2024-06-10 • Tags: maintenance, automation