Best practices for git maintenance?

1.5k Views Asked by At

I'm looking at the git-maintenance manual and is unclear for me how the actual maintenance tasks are performed. To my understanding, once I execute git maintenance run --auto, several tasks are executed in the background. For example, if I perform a git pull, any related maintenance tasks should be executed automatically.

The part I cannot properly comprehend is if these tasks need to be scheduled by myself prior, or the --auto switch does that for me. My goal is to have the following maintenance tasks executed at specified timeline:

  • gc: weekly, default disabled
  • commit-graph: hourly
  • prefetch: hourly
  • loose-objects: daily
  • incremental-repack: daily

I would like to know what are the proper git maintenance commands to properly schedule the above tasks and also to get your input of recommended timelines for each task, they are taken from the manual, except gc, which is disabled by default.

Current ./.git structure, prior running any git maintenance commands:

# git --version
git version 2.30.2

# ls -lah .git
total 303K
drwxr-xr-x  8 root root   13 Dec 27 17:18 .
drwxr-xr-x 11 root root   19 Dec 27 17:18 ..
-rw-r--r--  1 root root   21 Dec 27 17:18 HEAD
drwxr-xr-x  2 root root    2 Dec 27 17:17 branches
-rw-r--r--  1 root root  252 Dec 27 17:18 config
-rw-r--r--  1 root root   73 Dec 27 17:17 description
drwxr-xr-x  2 root root   15 Dec 27 17:17 hooks
-rw-r--r--  1 root root 553K Dec 27 17:18 index
drwxr-xr-x  2 root root    3 Dec 27 17:17 info
drwxr-xr-x  3 root root    4 Dec 27 17:18 logs
drwxr-xr-x  4 root root    4 Dec 27 17:17 objects
-rw-r--r--  1 root root  112 Dec 27 17:18 packed-refs
drwxr-xr-x  5 root root    5 Dec 27 17:18 refs

./git/config [maintenance] section:

[maintenance]
    auto = false
    strategy = incremental

I expected running git maintenance run --auto command to set auto = true, but it is not. Thank you for taking the time to provide an example, how to properly configure the repo maintenance.

0

There are 0 best solutions below