Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #2143 > unrolled thread

Split a git repository?

Started byRui Maciel <rui.maciel@gmail.com>
First post2012-09-03 11:16 +0100
Last post2012-09-06 19:46 +1200
Articles 6 — 4 participants

Back to article view | Back to comp.programming


Contents

  Split a git repository? Rui Maciel <rui.maciel@gmail.com> - 2012-09-03 11:16 +0100
    Re: Split a git repository? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 17:34 +0100
      Re: Split a git repository? Rui Maciel <rui.maciel@gmail.com> - 2012-09-05 12:24 +0100
        Re: Split a git repository? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-05 13:30 +0100
    Re: Split a git repository? Robert Wessel <robertwessel2@yahoo.com> - 2012-09-05 22:07 -0500
    Re: Split a git repository? Ian Collins <ian-news@hotmail.com> - 2012-09-06 19:46 +1200

#2143 — Split a git repository?

FromRui Maciel <rui.maciel@gmail.com>
Date2012-09-03 11:16 +0100
SubjectSplit a git repository?
Message-ID<k2201o$2n1$1@speranza.aioe.org>
Let's say there is a git repository which contains not only the source code 
tree of a project but also a subtree used to store an assorted set of 
documents.  

Does anyone know if there is a simple way to split that repository into two 
separate repositories, one dedicated to the souce code tree and the other to 
the documents?


Thanks in advance,
Rui Maciel

[toc] | [next] | [standalone]


#2144

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2012-09-03 17:34 +0100
Message-ID<0.3b41f11daf4c894d927a.20120903173438BST.87392zysip.fsf@bsb.me.uk>
In reply to#2143
Rui Maciel <rui.maciel@gmail.com> writes:

> Let's say there is a git repository which contains not only the source code 
> tree of a project but also a subtree used to store an assorted set of 
> documents.  
>
> Does anyone know if there is a simple way to split that repository into two 
> separate repositories, one dedicated to the souce code tree and the other to 
> the documents?

My first though is

  git rm docs/*
  git commit -a -m "docs/* now in their own repository"
  cd docs
  git init
  git add *

Obviously you might want the repository for docs somewhere else, in
which case you can use --git-dir=...

However, I can see some problems.  I don't know what happens when people
try to merge changes on removed files.  Presumably something sane, but I
don't know what.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#2153

FromRui Maciel <rui.maciel@gmail.com>
Date2012-09-05 12:24 +0100
Message-ID<k27con$51m$1@speranza.aioe.org>
In reply to#2144
Ben Bacarisse wrote:

> My first though is
> 
> git rm docs/*
> git commit -a -m "docs/* now in their own repository"
> cd docs
> git init
> git add *
> 
> Obviously you might want the repository for docs somewhere else, in
> which case you can use --git-dir=...
> 
> However, I can see some problems.  I don't know what happens when people
> try to merge changes on removed files.  Presumably something sane, but I
> don't know what.

Thanks for the help.  I was hoping for a magic trick that could to pull this 
off, such as an arcane command that could convert a subdirectory into a 
submodule, and in the process it would extract and remove all the history 
from the original repository and set up everything as required.  Alas, no 
such luck.


Thanks for the help,
Rui Maciel

[toc] | [prev] | [next] | [standalone]


#2154

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2012-09-05 13:30 +0100
Message-ID<0.d74063be4a944cc6119c.20120905133003BST.87627sveic.fsf@bsb.me.uk>
In reply to#2153
Rui Maciel <rui.maciel@gmail.com> writes:

> Ben Bacarisse wrote:
>
>> My first though is
>> 
>> git rm docs/*
>> git commit -a -m "docs/* now in their own repository"
>> cd docs
>> git init
>> git add *
>> 
>> Obviously you might want the repository for docs somewhere else, in
>> which case you can use --git-dir=...
>> 
>> However, I can see some problems.  I don't know what happens when people
>> try to merge changes on removed files.  Presumably something sane, but I
>> don't know what.
>
> Thanks for the help.  I was hoping for a magic trick that could to pull this 
> off, such as an arcane command that could convert a subdirectory into a 
> submodule, and in the process it would extract and remove all the history 
> from the original repository and set up everything as required.  Alas, no 
> such luck.

Ah, yes, you loose all the 'docs' history in the new repository (it's in
the old one of course, but after a while who'd think to look there?).

It might be better to revert docs back to it's initial state and then
replay the updates in the new repository.  I can see why you wanted this
to automated.

BTW, you need feedback from someone who is way more of a git expert than
I am before you can say "no such luck".  Maybe you've asked elsewhere,
though.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#2167

FromRobert Wessel <robertwessel2@yahoo.com>
Date2012-09-05 22:07 -0500
Message-ID<6l4g48prjqcspvm4lohenl9qu0m7hgc564@4ax.com>
In reply to#2143
On Mon, 03 Sep 2012 11:16:25 +0100, Rui Maciel <rui.maciel@gmail.com>
wrote:

>Let's say there is a git repository which contains not only the source code 
>tree of a project but also a subtree used to store an assorted set of 
>documents.  
>
>Does anyone know if there is a simple way to split that repository into two 
>separate repositories, one dedicated to the souce code tree and the other to 
>the documents?


I'm far from a git expert, but it seems to be that a split like that
shouldn't normally be possible - before the point of the split, both
portions are part of the same project, so revision "split-1"
necessarily includes stuff from both portions.

Wouldn't the "natural" thing be to duplicate the repository and then
delete the unwanted portions from each?

[toc] | [prev] | [next] | [standalone]


#2168

FromIan Collins <ian-news@hotmail.com>
Date2012-09-06 19:46 +1200
Message-ID<aar2n0Fh6U1@mid.individual.net>
In reply to#2143
On 09/ 3/12 10:16 PM, Rui Maciel wrote:
> Let's say there is a git repository which contains not only the source code
> tree of a project but also a subtree used to store an assorted set of
> documents.
>
> Does anyone know if there is a simple way to split that repository into two
> separate repositories, one dedicated to the souce code tree and the other to
> the documents?

If the documents aren't related to the code, create a new repository and 
move them there.  If they are associated with the code, leave well alone!

-- 
Ian Collins

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web