Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view progress of git gc in the background?

Tags:

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.

like image 707
Flimm Avatar asked Sep 20 '16 17:09

Flimm


People also ask

Does git gc run automatically?

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.

How often does git gc run?

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.

Does GitHub run git gc?

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.


1 Answers

You can configure it to be non-background, then I belive it should report its progress:

 git config gc.autoDetach false
like image 58
max630 Avatar answered Oct 13 '22 01:10

max630