git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Splitting up a repository
@ 2010-12-04  5:27 Evan Driscoll
  2010-12-04  5:33 ` Jeff King
  2010-12-04  7:09 ` Nguyen Thai Ngoc Duy
  0 siblings, 2 replies; 6+ messages in thread
From: Evan Driscoll @ 2010-12-04  5:27 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

Say I have a repo where there are directories repo/foo, repo/bar,
repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough
that I put them together initially, but loosely enough that I now wish I
could check out just 'repo/foo'. Since Git doesn't support partial
checkouts (a bit annoying!), I now have to split this repository into
separate ones. I'd of course like to keep history.

Is there a better way than making several (recursive) copies of the
repository, deleting all but one directory in each copy, then moving the
contents of that directory up a level? (And perhaps setting up a Git
superproject at the original location. I do know about that.)

I've probably spent more time typing up this email than it would take to
do, but I'm curious if there's some git magic or something that would be
better for some reason. :-)

Evan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 543 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Splitting up a repository
  2010-12-04  5:27 Splitting up a repository Evan Driscoll
@ 2010-12-04  5:33 ` Jeff King
  2010-12-04  6:19   ` Evan Driscoll
  2010-12-04  7:09 ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff King @ 2010-12-04  5:33 UTC (permalink / raw)
  To: Evan Driscoll; +Cc: git

On Fri, Dec 03, 2010 at 11:27:57PM -0600, Evan Driscoll wrote:

> Say I have a repo where there are directories repo/foo, repo/bar,
> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough
> that I put them together initially, but loosely enough that I now wish I
> could check out just 'repo/foo'. Since Git doesn't support partial
> checkouts (a bit annoying!), I now have to split this repository into
> separate ones. I'd of course like to keep history.
> 
> Is there a better way than making several (recursive) copies of the
> repository, deleting all but one directory in each copy, then moving the
> contents of that directory up a level? (And perhaps setting up a Git
> superproject at the original location. I do know about that.)

Rewrite the history of each directory with git-filter-branch. It even
has a "--subdirectory-filter" option that will do exactly what you want.

-Peff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Splitting up a repository
  2010-12-04  5:33 ` Jeff King
@ 2010-12-04  6:19   ` Evan Driscoll
  0 siblings, 0 replies; 6+ messages in thread
From: Evan Driscoll @ 2010-12-04  6:19 UTC (permalink / raw)
  To: Jeff King; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

On 12/3/2010 23:33, Jeff King wrote:
>> Is there a better way than making several (recursive) copies of the
>> repository, deleting all but one directory in each copy, then moving the
>> contents of that directory up a level? (And perhaps setting up a Git
>> superproject at the original location. I do know about that.)
> 
> Rewrite the history of each directory with git-filter-branch. It even
> has a "--subdirectory-filter" option that will do exactly what you want.

Great, thanks. I had to mess around with a submodule that was inside one
of the subdirectories that didn't make it through the history rewrite,
and I could see that have getting slightly hairy, but at least in my
case it was pretty simple. Other than that, worked like a charm.

Evan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 543 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Splitting up a repository
  2010-12-04  5:27 Splitting up a repository Evan Driscoll
  2010-12-04  5:33 ` Jeff King
@ 2010-12-04  7:09 ` Nguyen Thai Ngoc Duy
  2010-12-04  7:14   ` Evan Driscoll
  1 sibling, 1 reply; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-12-04  7:09 UTC (permalink / raw)
  To: Evan Driscoll; +Cc: git

On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
> Say I have a repo where there are directories repo/foo, repo/bar,
> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough
> that I put them together initially, but loosely enough that I now wish I
> could check out just 'repo/foo'. Since Git doesn't support partial
> checkouts (a bit annoying!),

Um.. it does support partial checkouts (check out man page of
git-read-tree, sparse checkout section). But you must do a full clone
(i.e. your repository will have bar and baz, even if you only checkout
foo).
-- 
Duy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Splitting up a repository
  2010-12-04  7:09 ` Nguyen Thai Ngoc Duy
@ 2010-12-04  7:14   ` Evan Driscoll
  2010-12-04  7:41     ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 6+ messages in thread
From: Evan Driscoll @ 2010-12-04  7:14 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

On 12/4/2010 1:09, Nguyen Thai Ngoc Duy wrote:
> On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
>> Say I have a repo where there are directories repo/foo, repo/bar,
>> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough
>> that I put them together initially, but loosely enough that I now wish I
>> could check out just 'repo/foo'. Since Git doesn't support partial
>> checkouts (a bit annoying!),
> 
> Um.. it does support partial checkouts (check out man page of
> git-read-tree, sparse checkout section). But you must do a full clone
> (i.e. your repository will have bar and baz, even if you only checkout
> foo).

That's sort of spiffy, and I did not know about that. So again, thanks.

That said, I did a bit of reading around, and I'm not sure it does what
I need.
http://stackoverflow.com/questions/2336580/sparse-checkout-in-git-1-7-0
is basically what I want, and the answers seem to indicate it isn't
possible. (In other words, in my example, when I want a checkout of
repo/foo, the .git directory needs to be a sibling of foo's contents,
not a sibling of foo.)

Evan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 543 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Splitting up a repository
  2010-12-04  7:14   ` Evan Driscoll
@ 2010-12-04  7:41     ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-12-04  7:41 UTC (permalink / raw)
  To: Evan Driscoll; +Cc: git

On Sat, Dec 4, 2010 at 2:14 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
> On 12/4/2010 1:09, Nguyen Thai Ngoc Duy wrote:
>> On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
>>> Say I have a repo where there are directories repo/foo, repo/bar,
>>> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough
>>> that I put them together initially, but loosely enough that I now wish I
>>> could check out just 'repo/foo'. Since Git doesn't support partial
>>> checkouts (a bit annoying!),
>>
>> Um.. it does support partial checkouts (check out man page of
>> git-read-tree, sparse checkout section). But you must do a full clone
>> (i.e. your repository will have bar and baz, even if you only checkout
>> foo).
>
> That's sort of spiffy, and I did not know about that. So again, thanks.
>
> That said, I did a bit of reading around, and I'm not sure it does what
> I need.
> http://stackoverflow.com/questions/2336580/sparse-checkout-in-git-1-7-0
> is basically what I want, and the answers seem to indicate it isn't
> possible. (In other words, in my example, when I want a checkout of
> repo/foo, the .git directory needs to be a sibling of foo's contents,
> not a sibling of foo.)

If you want different layout too, then no it does not do that.
Splitting repo is probably best.
-- 
Duy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-04  7:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-04  5:27 Splitting up a repository Evan Driscoll
2010-12-04  5:33 ` Jeff King
2010-12-04  6:19   ` Evan Driscoll
2010-12-04  7:09 ` Nguyen Thai Ngoc Duy
2010-12-04  7:14   ` Evan Driscoll
2010-12-04  7:41     ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).