git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git repack vs git gc --aggressive

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 7, 2012, 19:05 UTC
Message-ID
<7vvcguv7y2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120807184405.GA440@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> So the packing parameters are the same these days for either method.
> Note that "git gc --aggressive" will also use "-f" to recompute all
> deltas. This is more expensive, but gives git more flexibility if the
> old deltas were sub-optimal (typically, this is the case if the existing
> pack was generated by fast-import, which favors speed of import versus
> coming up with an optimal storage pattern).

Also your fetch often results in storing the pack received from the other end straight to your local repository (with necessary objects to complete the pack the other end did not send appended at the end). If the server side hasn't been packed with "-f", you will inherit the badness until you repack with "-f".

> Of course, every workload is different. One can develop pathological
> cases where --depth=500 saves a lot of space. But it's unlikely that it
> is the case for a normal repository. You can always try both and see the
> result.

For a dataset where ridiculously large depth really is a win, these objects would have to be reasonably large and cost of expanding the base and then applying hundreds of delta to recover one object may not be negligible. The user should consider if he is willing to pay the price every time he does a local Git operation.

Show 5 quoted lines
> In fact, I'd also test how just "git gc" behaves versus "git gc
> --aggressive" for your repo. The former is much less expensive to run.
> You really shouldn't need to be running "--aggressive" all the time, so
> if you are looking at doing a nightly repack or similar, just "git gc"
> is probably fine.

As I am coming from "large depth is harmful" school, I would recommend

 - "git repack -a -d -f" with large "--window" with reasonably short
   "--depth" once, and mark the result with .keep;
 
 - "git repack -a -d -f" once every several weeks; and
 - "git gc" or "git repack" (without any other options) daily.
and ignore "--aggressive" entirely.
Previous: Jeff KingNext: Felix Natter
Message 3 of 7 in “git repack vs git gc --aggressive”
  1. Felix NatterAug 7, 2012
  2. Jeff KingAug 7, 2012
  3. Junio C HamanoAug 7, 2012
  4. Felix NatterAug 10, 2012
  5. Junio C HamanoAug 10, 2012
  6. Marc BranchaudAug 13, 2012
  7. Junio C HamanoAug 13, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.