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

Re: does git prune packs?

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 14, 2005, 15:30 UTC
Message-ID
<Pine.LNX.4.58.0509140824090.26803@g5.osdl.org>
In-Reply-To
<43283E66.5080101@pobox.com>
On Wed, 14 Sep 2005, Jeff Garzik wrote:
> 
> I never repack, I just use your packs.
Oh, ok. Then, do something like this:
	mv .git/objects/pack .git/objects/old-packs
	mkdir .git/objects/pack
	for i in .git/objects/old-packs/*.pack
	do
		echo $i:
		git-unpack-objects < $i
	done

and it will do the right thing. Doing the right thing means, among other things, that if an object already exists in an alternate object directory, it won't be written to disk again.

(So if you have an "alternates" file pointing to my objects, and your packs contain mainly/only objects that I've pulled, basically nothing will actually be unpacked.)

After that, do a git-fsck-cache to make sure everything looks good, and just "rm -rf .git/objects/old-packs".

And yes, we could make something like this a helper script.

NOTE! During the unpacking, the repository may not be usable, so make sure that nobody else tries to access it while you do this.

		Linus
Previous: Jeff Garzik
Message 4 of 4 in “does git prune packs?”
  1. Jeff GarzikSep 14, 2005
  2. Linus TorvaldsSep 14, 2005
  3. Jeff GarzikSep 14, 2005
  4. Linus TorvaldsSep 14, 2005

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.