LinuxCommandLibrary

git-maintenance

Automated repository optimization

TLDR

Start background maintenance

$ git maintenance start
copy
Run maintenance now
$ git maintenance run
copy
Stop background maintenance
$ git maintenance stop
copy
Register repository
$ git maintenance register
copy
Run specific task
$ git maintenance run --task=[gc]
copy

SYNOPSIS

git maintenance command [options]

DESCRIPTION

git maintenance manages repository maintenance tasks automatically. It handles garbage collection, commit graph updates, prefetch, and incremental repack either on-demand or through scheduled background jobs.
Background maintenance improves repository performance over time without manual intervention. The `start` subcommand registers the repository and sets up a system scheduler to run tasks periodically. Configuration controls which tasks run and how frequently.

PARAMETERS

start

Enable background maintenance.
stop
Disable background maintenance.
run
Run maintenance tasks.
register
Register repo for maintenance.
unregister
Unregister repository.
--task TASK
Specific task to run.
--auto
Only run if needed.
--help
Display help information.

CONFIGURATION

~/.gitconfig

Global maintenance configuration for scheduled tasks.
$ [maintenance]
    auto = true
    strategy = incremental
copy

CAVEATS

Background jobs need system scheduler. Some tasks may be slow. Configuration in git config.

HISTORY

git maintenance was added in Git 2.29 to provide automated repository optimization, replacing manual gc invocation.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community