Skip to contentSkip to conversation

Sharing repositories later on

DISCUSSION Erik Mouw 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

Erik Mouw

author
#0 lore raw

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

Signature · 2 lines
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
#1 lore raw
Quoted 10 lines · Erik Mouw

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?

author
#2 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 5 lines · Erik Mouw

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

Signature · 2 lines
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
#3 lore raw
In reply to Erik Mouw
Quoted 3 lines · Erik Mouw

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