{"thread":{"id":"13360","subject":"Best way to optimize a git repository?","startedAt":"2008-05-03T00:34:02Z","lastAt":"2008-05-03T10:02:35Z","messageCount":2,"participants":["skillzero@gmail.com","Stephen R. van den Berg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75897","messageId":"2729632a0805021734h72196639x8789a00ce9be4059@mail.gmail.com","threadId":"13360","inReplyTo":null,"subject":"Best way to optimize a git repository?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2008-05-03T00:34:02Z","receivedAt":"2008-05-03T00:34:02Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"I want to periodically optimize my repositories even if it takes a\nlong time to run the command. Should I do 'git gc --aggressive', 'git\nrepack -a -d', 'git prune', or some combination? The documentation\nimplies that things like git gc will use git repack, but I'm sort of\nlooking for the definitive answer of what I should run to fully\noptimize my repositories. These are relatively new repositories, all\ncreated with git 1.5.5.1.\n\nI also read somewhere (but can't find now) that some of these commands\nshouldn't be run while other people might be accessing the repository.\nI want to run these commands on a server that multiple people clone\nand pull from and push to. Is that safe to do? I'm okay if clone,\npull, or push fail during this time (although I'd prefer if they\ndidn't fail), I just don't want to corrupt the repository.\n"},{"id":"75908","messageId":"20080503100235.GA16989@cuci.nl","threadId":"13360","inReplyTo":"2729632a0805021734h72196639x8789a00ce9be4059@mail.gmail.com","subject":"Re: Best way to optimize a git repository?","fromName":"Stephen R. van den Berg","fromEmail":"srb@cuci.nl","sentAt":"2008-05-03T10:02:35Z","receivedAt":"2008-05-03T10:02:35Z","isPatch":false,"sender":{"key":"srb@cuci.nl","avatar":"https://gravatar.com/avatar/f75389059e827634d38e9df2a9b6ecbd50028b5a454442efa1c7205b7ff29c6a?d=mp&s=160"},"body":"skillzero@gmail.com wrote:\n>I want to periodically optimize my repositories even if it takes a\n>long time to run the command. Should I do 'git gc --aggressive', 'git\n\n>I also read somewhere (but can't find now) that some of these commands\n>shouldn't be run while other people might be accessing the repository.\n\nCaveat emptor, indeed.\n\nI have in my /etc/gitconfig the following:\n\n[repack]\n   UseDeltaBaseOffset = true\n[pack]\n   compression = 9\n[alias]\n   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\n\nA subsequent \"git packall\" does the trick, but this is best done on an\notherwise idle repository.\n-- \nSincerely,                                                          srb@cuci.nl\n           Stephen R. van den Berg.\n\"What do I do when I see someone *extremely gorgeous*?\n I stare, I smile, and when I get tired... I put the mirror down.\"\n"}]}