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

Re: Best way to optimize a git repository?

From
Stephen R. van den Berg <srb@cuci.nl>
Date
May 3, 2008, 10:02 UTC
Message-ID
<20080503100235.GA16989@cuci.nl>
In-Reply-To
<2729632a0805021734h72196639x8789a00ce9be4059@mail.gmail.com>
skillzero@gmail.com wrote:
>I want to periodically optimize my repositories even if it takes a
>long time to run the command. Should I do 'git gc --aggressive', 'git
>I also read somewhere (but can't find now) that some of these commands
>shouldn't be run while other people might be accessing the repository.
Caveat emptor, indeed.
I have in my /etc/gitconfig the following:
[repack]
   UseDeltaBaseOffset = true
[pack]
   compression = 9
[alias]
   packall = !rm -rf .git/ORIG_HEAD .git/FETCH_HEAD .git/index .git/logs .git/info/refs .git/objects/pack/pack-*.keep .git/refs/original .git/refs/patches .git/patches && git prune --expire now && git repack -a -d --window=200 && git gc

A subsequent "git packall" does the trick, but this is best done on an otherwise idle repository.

-- 
Sincerely,                                                          srb@cuci.nl
           Stephen R. van den Berg.
"What do I do when I see someone *extremely gorgeous*?
 I stare, I smile, and when I get tired... I put the mirror down."
Previous: skillzero@gmail.com
Message 2 of 2 in “Best way to optimize a git repository?”
  1. skillzero@gmail.comMay 3, 2008
  2. Stephen R. van den BergMay 3, 2008

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.