# Sharing repositories later on

4 messages from 2006-07-12 to 2006-07-12. Participants: Erik Mouw, Junio C Hamano, Linus Torvalds.
Thread: https://gitlist.dev/t/4861

## Erik Mouw, 2006-07-12 13:28

Subject: Sharing repositories later on
Message-ID: <20060712132800.GA7328@harddisk-recovery.com>
URL: https://gitlist.dev/e/20060712132800.GA7328%40harddisk-recovery.com

```
Hi,

I just learned out about "git clone -s" to share objects between
repositories. How do I use that with already existing repositories?

Right now I have a "linux-2.6" repository to track Linus's 2.6 kernel
tree and an "elinux-2.6" tree that pulls from linux-2.6 and holds my
own changes. I created a file .git/objects/info/alternates that
contains the line "/home/erik/git/linux-2.6/.git/objects". Now how do I
get rid of the "old" objects and packs without loosing my changes?


Erik

-- 
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

```

## Junio C Hamano, 2006-07-12 15:21

Subject: Re: Sharing repositories later on
Message-ID: <7vpsgazw5j.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vpsgazw5j.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060712132800.GA7328@harddisk-recovery.com>

```
Erik Mouw <erik@harddisk-recovery.com> writes:

> Hi,
>
> I just learned out about "git clone -s" to share objects between
> repositories. How do I use that with already existing repositories?
>
> Right now I have a "linux-2.6" repository to track Linus's 2.6 kernel
> tree and an "elinux-2.6" tree that pulls from linux-2.6 and holds my
> own changes. I created a file .git/objects/info/alternates that
> contains the line "/home/erik/git/linux-2.6/.git/objects". Now how do I
> get rid of the "old" objects and packs without loosing my changes?

repack -a -d -l perhaps?

```

## Linus Torvalds, 2006-07-12 15:47

Subject: Re: Sharing repositories later on
Message-ID: <Pine.LNX.4.64.0607120843570.5623@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0607120843570.5623%40g5.osdl.org
In-Reply-To: <20060712132800.GA7328@harddisk-recovery.com>

```


On Wed, 12 Jul 2006, Erik Mouw wrote:
> 
> I just learned out about "git clone -s" to share objects between
> repositories. How do I use that with already existing repositories?

Do

	echo "/source/git/project/.git/objects/" > .git/objects/info/alternates

and then follow it up with

	git repack -a -d -l

where the "-l" means that it will only put _local_ objects in the 
pack-file (strictly speaking, it will put any loose objects from the 
alternate tree too, so you'll have a fully packed archive, but it won't 
duplicate objects that are already packed in the alternate tree).

		Linus

```

## Erik Mouw, 2006-07-12 15:57

Subject: Re: Sharing repositories later on
Message-ID: <20060712155751.GE7328@harddisk-recovery.com>
URL: https://gitlist.dev/e/20060712155751.GE7328%40harddisk-recovery.com
In-Reply-To: <7vpsgazw5j.fsf@assigned-by-dhcp.cox.net>

```
On Wed, Jul 12, 2006 at 08:21:28AM -0700, Junio C Hamano wrote:
> Erik Mouw <erik@harddisk-recovery.com> writes:
> > Right now I have a "linux-2.6" repository to track Linus's 2.6 kernel
> > tree and an "elinux-2.6" tree that pulls from linux-2.6 and holds my
> > own changes. I created a file .git/objects/info/alternates that
> > contains the line "/home/erik/git/linux-2.6/.git/objects". Now how do I
> > get rid of the "old" objects and packs without loosing my changes?
> 
> repack -a -d -l perhaps?

Thanks, that did the trick. I now have a small pack with around 100
objects.


Erik

-- 
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

```
