When I run a command like git gc
, I get a message like this:
$ git fetch
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
It seems like newer versions of Git run auto-packing in the background now, which is a nice feature! If I run git gc
manually, I get this message:
$ git gc
fatal: gc is already running on machine 'machinename' pid 14009 (use --force if not)
This makes sense. However, I would quite like to be able to watch the progress of gc
that is running the background somehow?
Obviously, I could run something like while ! git gc ; do sleep 1s ; done
, but that doesn't give me nearly as much information as a pretty Git progress indicator could, and it runs auto-packing an additional time.
The git gc --auto command variant first checks if any housekeeping is required on the repo before executing. If it finds housekeeping is not needed it exits without doing any work. Some Git commands implicitly run git gc --auto after execution to clean up any loose objects they have created.
The default is 60 days. See git-rerere[1]. Records of conflicted merge you have not resolved are kept for this many days when git rerere gc is run.
The git gc command cleans up unnecessary files and optimizes the local repository. GitHub runs this operation on its hosted repositories automatically on a regular basis based on a variety of triggers.
You can configure it to be non-background, then I belive it should report its progress:
git config gc.autoDetach false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With