threads / discuss / 22874

split up a repository

Subject: split up a repository

## tl;dr

8 messages between Mar 2, 2010 and Mar 3, 2010.

replies: 7people: 5as markdown or json

Kovacs, Levente· Mar 2, 2010, 00:12 UTC · lore
Hi all,

Ok, I *WAS* an SVN user, so forgive my ignorance. I have successfully migrated from SVN to git. However, I had only one repository under my SVN server, which is not a good approach with git.

http://logonex.eu/git/?p=svn.git;a=summary
Now I have one git repository, which I'd like to split up to several others. Does it possible with git? If it is, how?

How can I split up a single repo to several others? It would be nice to keep the history.

Thank you for your help in advance.
Levente
Chris Packham· Mar 2, 2010, 00:36 UTC · re: Kovacs, Levente · lore

Re: split up a repository

Hi,
On Mon, Mar 1, 2010 at 4:12 PM, Kovacs, Levente <leventelist@gmail.com> wrote:
Show 18 quoted lines
> Hi all,
>
>
> Ok, I *WAS* an SVN user, so forgive my ignorance. I have successfully
> migrated from SVN to git. However, I had only one repository under my
> SVN server, which is not a good approach with git.
>
> http://logonex.eu/git/?p=svn.git;a=summary
>
> Now I have one git repository, which I'd like to split up to several others. Does it possible with git? If it is, how?
>
> How can I split up a single repo to several others? It would be nice to
> keep the history.
>
> Thank you for your help in advance.
>
> Levente
> --

'git filter-branch' should do what you need. Have a read of this [1] recent discussion and the docs for filter-branch [2].

[1] http://thread.gmane.org/gmane.comp.version-control.git/138382 [2] http://www.kernel.org/pub/software/scm/git/docs/v1.7.0.1/git-filter-branch.html

Sverre Rabbelier· Mar 2, 2010, 10:40 UTC · re: Kovacs, Levente · lore

Re: split up a repository

Heya,
On Tue, Mar 2, 2010 at 01:12, Kovacs, Levente <leventelist@gmail.com> wrote:
> How can I split up a single repo to several others? It would be nice to
> keep the history.

Sounds like a job for.... subtree man! Avery (cc-ed) has written a program 'git subtree' that lets you split off subtrees from a git repository (and optionally merge them back later on). I reckon that's what you want, yes?

-- 
Cheers,

Sverre Rabbelier
Levente Kovacs· Mar 2, 2010, 23:21 UTC · re: Sverre Rabbelier · lore

Re: split up a repository

On Tue, 2 Mar 2010 11:40:41 +0100 Sverre Rabbelier <srabbelier@gmail.com> wrote:

> Sounds like a job for.... subtree man!
Yes, it seems!

Ok. Really newbie question here. Just before I start to mess up my repositories. I've cloned the git-subtree, and the install script would put the script into /usr/lib/git-core. Is there any way to install the script somewhere under /usr/local ?

Thanks,
-- 
Levente Kovacs
http://logonex.eu

-- 
Levente Kovacs
http://logonex.eu
Sverre Rabbelier· Mar 2, 2010, 23:19 UTC · re: Levente Kovacs · lore

Re: split up a repository

Heya,
On Wed, Mar 3, 2010 at 00:21, Levente Kovacs <leventelist@gmail.com> wrote:
> Ok. Really newbie question here. Just before I start to mess up my
> repositories.
PROTIP: Back up your repository before messing with it ;).
> I've cloned the git-subtree, and the install script would put
> the script into /usr/lib/git-core. Is there any way to install the script
> somewhere under /usr/local ?
I'll leave git subtree specific questions to Avery :).
-- 
Cheers,

Sverre Rabbelier
Avery Pennarun· Mar 3, 2010, 01:40 UTC · re: Levente Kovacs · lore

Re: split up a repository

On Tue, Mar 2, 2010 at 6:21 PM, Levente Kovacs <leventelist@gmail.com> wrote:
Show 5 quoted lines
> On Tue, 2 Mar 2010 11:40:41 +0100
> Ok. Really newbie question here. Just before I start to mess up my
> repositories. I've cloned the git-subtree, and the install script would put
> the script into /usr/lib/git-core. Is there any way to install the script
> somewhere under /usr/local ?

The actual function of git-subtree is one single file. You can just copy it to wherever you like. Personally, I add the git-subtree source directory to my PATH from .bashrc... but I guess I'm special because I also change my version of git-subtree a lot :)

Make sure to run 'make test' first so you know it's working on your computer.

And I'll second Sverre's suggestion to *always* back up your repository before doing weird stuff (although git-subtree is designed to refuse to overwrite existing branches, and nobody has ever reported it damaging anything).

Have fun,
Avery
Bill Lear· Mar 3, 2010, 14:04 UTC · re: Avery Pennarun · lore

Re: split up a repository

On Tuesday, March 2, 2010 at 20:40:57 (-0500) Avery Pennarun writes:
Show 8 quoted lines
>On Tue, Mar 2, 2010 at 6:21 PM, Levente Kovacs <leventelist@gmail.com> wrote:
>> On Tue, 2 Mar 2010 11:40:41 +0100
>> Ok. Really newbie question here. Just before I start to mess up my
>> repositories. I've cloned the git-subtree, and the install script would put
>> the script into /usr/lib/git-core. Is there any way to install the script
>> somewhere under /usr/local ?
>
>The actual function of git-subtree is one single file....

Does git-subtree support branching of the "main" repository and sub-trees in coordinated (one step) fashion?

Bill
Avery Pennarun· Mar 3, 2010, 19:19 UTC · re: Bill Lear · lore

Re: split up a repository

On Wed, Mar 3, 2010 at 9:04 AM, Bill Lear <rael@zopyra.com> wrote:
> Does git-subtree support branching of the "main" repository and
> sub-trees in coordinated (one step) fashion?
Yes.
Avery

← back to recent threads