# Splitting a repository but sharing the common parts of the object database

5 messages from 2010-12-13 to 2010-12-13. Participants: Phillip Susi, Jonathan Nieder, Stephen Bash.
Thread: https://gitlist.dev/t/26041

## Phillip Susi, 2010-12-13 18:39

Subject: Splitting a repository but sharing the common parts of the object database
Message-ID: <4D066873.4020208@cfl.rr.com>
URL: https://gitlist.dev/e/4D066873.4020208%40cfl.rr.com

```
I have recently started a new project that has begun its life as a fork
of an old project, then heavily modified.  At the same time I am looking
into migrating from svn to git.  Since this is a separate project, I
thought I should split it into a separate git repository and keep them
separate going forward, however, since they have common ancestry up to
this point, I would like to make sure that all of that data is not
duplicated.

I thought what I could do is set up an initial repository that is fully
packed and use it as a read only archive to contain all of the shared
history, then clone that into two new repositories for the two separate
projects.  It seems like I can do this by running a clone -s so that the
archive is set up to be an alternate object store, then its big pack
file will be found and used for all of the old history, but new commits
will be specific to each of the two new respective projects.  The
problem I run into though, is when it comes time to repack the new projects.

If I run a repack -a, then the new project has everything copied out of
the archive and into its new main pack, rather than continuing to use
the archive repository for old history, and just pack everything since
then.  I guess I am looking for is somewhere between a full repack and
an incremental; a way to make repack -a discard existing local packs,
but to respect the alternate packs and omit objects they contain from
the new local pack.  Is this possible?

```

## Jonathan Nieder, 2010-12-13 19:20

Subject: Re: Splitting a repository but sharing the common parts of the object database
Message-ID: <20101213192053.GA30315@burratino>
URL: https://gitlist.dev/e/20101213192053.GA30315%40burratino
In-Reply-To: <4D066873.4020208@cfl.rr.com>

```
Hi Phillip,

Phillip Susi wrote:

> If I run a repack -a, then the new project has everything copied out of
> the archive and into its new main pack, rather than continuing to use
> the archive repository for old history, and just pack everything since
> then.  I guess I am looking for is somewhere between a full repack and
> an incremental; a way to make repack -a discard existing local packs,
> but to respect the alternate packs and omit objects they contain from
> the new local pack.

You might be interested in girocco's fork support.  See
http://repo.or.cz/w/girocco.git/blob/HEAD:/jobd/gc.sh for starters.

(Yes, the short answer is "-l" but showing where I got that answer
from seems a little easier. :))

```

## Stephen Bash, 2010-12-13 19:50

Subject: Re: Splitting a repository but sharing the common parts of the object database
Message-ID: <31673515.186200.1292269850925.JavaMail.root@mail.hq.genarts.com>
URL: https://gitlist.dev/e/31673515.186200.1292269850925.JavaMail.root%40mail.hq.genarts.com
In-Reply-To: <20101213192053.GA30315@burratino>

```
----- Original Message -----
> From: "Jonathan Nieder" <jrnieder@gmail.com>
> To: "Phillip Susi" <psusi@cfl.rr.com>
> Cc: git@vger.kernel.org
> Sent: Monday, December 13, 2010 2:20:53 PM
> Subject: Re: Splitting a repository but sharing the common parts of the object database
> Hi Phillip,
> 
> Phillip Susi wrote:
> 
> > If I run a repack -a, then the new project has everything copied out
> > of the archive and into its new main pack, rather than continuing to
> > use the archive repository for old history, and just pack everything
> > since then. I guess I am looking for is somewhere between a full repack
> > and an incremental; a way to make repack -a discard existing local
> > packs, but to respect the alternate packs and omit objects they contain
> > from the new local pack.
> 
> You might be interested in girocco's fork support. See
> http://repo.or.cz/w/girocco.git/blob/HEAD:/jobd/gc.sh for starters.

You might also be interested in Pro Git's entry on git-replace:

  http://progit.org/2010/03/17/replace.html

It's a completely different approach than what you're suggesting, but might open up new and interesting avenues.

Stephen

```

## Phillip Susi, 2010-12-13 23:17

Subject: Re: Splitting a repository but sharing the common parts of the object database
Message-ID: <4D06A98B.1060408@cfl.rr.com>
URL: https://gitlist.dev/e/4D06A98B.1060408%40cfl.rr.com
In-Reply-To: <20101213192053.GA30315@burratino>

```
On 12/13/2010 02:20 PM, Jonathan Nieder wrote:
> You might be interested in girocco's fork support.  See
> http://repo.or.cz/w/girocco.git/blob/HEAD:/jobd/gc.sh for starters.
>
> (Yes, the short answer is "-l" but showing where I got that answer
> from seems a little easier. :))

Yes, -l looks like exactly what I need.  Now I don't suppose there is a 
way to make it sticky so I don't have to remember to use it when 
repacking every time?  :)

I checked the man page for git-config and it doesn't show an option that 
sounds like it.

```

## Jonathan Nieder, 2010-12-13 23:25

Subject: Re: Splitting a repository but sharing the common parts of the object database
Message-ID: <20101213232508.GB32103@burratino>
URL: https://gitlist.dev/e/20101213232508.GB32103%40burratino
In-Reply-To: <4D06A98B.1060408@cfl.rr.com>

```
Phillip Susi wrote:

> Yes, -l looks like exactly what I need.  Now I don't suppose there
> is a way to make it sticky so I don't have to remember to use it
> when repacking every time?  :)

Maybe

	[alias "repackfork"]
		repack -a -d -f -l ...whatever other options are wanted...

```
