# does git prune packs?

4 messages from 2005-09-14 to 2005-09-14. Participants: Jeff Garzik, Linus Torvalds.
Thread: https://gitlist.dev/t/1797

## Jeff Garzik, 2005-09-14 11:13

Subject: does git prune packs?
Message-ID: <432805E6.6030905@pobox.com>
URL: https://gitlist.dev/e/432805E6.6030905%40pobox.com

```

Does git-prune-packed eliminate packs that have been superceded by other 
packs?

	Jeff

```

## Linus Torvalds, 2005-09-14 15:08

Subject: Re: does git prune packs?
Message-ID: <Pine.LNX.4.58.0509140808010.26803@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0509140808010.26803%40g5.osdl.org
In-Reply-To: <432805E6.6030905@pobox.com>

```


On Wed, 14 Sep 2005, Jeff Garzik wrote:
> 
> Does git-prune-packed eliminate packs that have been superceded by other 
> packs?

Nope. Pretty hard to do. Unless you just repack everything, at which point

	git repack -a -d

will do the right thing.

		Linus

```

## Jeff Garzik, 2005-09-14 15:14

Subject: Re: does git prune packs?
Message-ID: <43283E66.5080101@pobox.com>
URL: https://gitlist.dev/e/43283E66.5080101%40pobox.com
In-Reply-To: <Pine.LNX.4.58.0509140808010.26803@g5.osdl.org>

```
Linus Torvalds wrote:
> 
> On Wed, 14 Sep 2005, Jeff Garzik wrote:
> 
>>Does git-prune-packed eliminate packs that have been superceded by other 
>>packs?
> 
> 
> Nope. Pretty hard to do. Unless you just repack everything, at which point
> 
> 	git repack -a -d
> 
> will do the right thing.

I never repack, I just use your packs.

Easier on my hard disk, vastly reduces upload time (cable modem == slow 
uploads), since I can ssh to master.kernel.org and hardlink, and easier 
on kernel.org.

I'll remove the old packs manually.

Thanks,

	Jeff

```

## Linus Torvalds, 2005-09-14 15:30

Subject: Re: does git prune packs?
Message-ID: <Pine.LNX.4.58.0509140824090.26803@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0509140824090.26803%40g5.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

```
