{"thread":{"id":"25948","subject":"Splitting up a repository","startedAt":"2010-12-04T05:27:57Z","lastAt":"2010-12-04T07:41:45Z","messageCount":6,"participants":["Evan Driscoll","Jeff King","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"157292","messageId":"4CF9D15D.7090001@cs.wisc.edu","threadId":"25948","inReplyTo":null,"subject":"Splitting up a repository","fromName":"Evan Driscoll","fromEmail":"driscoll@cs.wisc.edu","sentAt":"2010-12-04T05:27:57Z","receivedAt":"2010-12-04T05:27:57Z","isPatch":false,"sender":{"key":"driscoll@cs.wisc.edu","avatar":null},"body":"Say I have a repo where there are directories repo/foo, repo/bar,\nrepo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough\nthat I put them together initially, but loosely enough that I now wish I\ncould check out just 'repo/foo'. Since Git doesn't support partial\ncheckouts (a bit annoying!), I now have to split this repository into\nseparate ones. I'd of course like to keep history.\n\nIs there a better way than making several (recursive) copies of the\nrepository, deleting all but one directory in each copy, then moving the\ncontents of that directory up a level? (And perhaps setting up a Git\nsuperproject at the original location. I do know about that.)\n\nI've probably spent more time typing up this email than it would take to\ndo, but I'm curious if there's some git magic or something that would be\nbetter for some reason. :-)\n\nEvan\n\n"},{"id":"157293","messageId":"20101204053304.GA7311@sigill.intra.peff.net","threadId":"25948","inReplyTo":"4CF9D15D.7090001@cs.wisc.edu","subject":"Re: Splitting up a repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-12-04T05:33:04Z","receivedAt":"2010-12-04T05:33:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Dec 03, 2010 at 11:27:57PM -0600, Evan Driscoll wrote:\n\n> Say I have a repo where there are directories repo/foo, repo/bar,\n> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough\n> that I put them together initially, but loosely enough that I now wish I\n> could check out just 'repo/foo'. Since Git doesn't support partial\n> checkouts (a bit annoying!), I now have to split this repository into\n> separate ones. I'd of course like to keep history.\n> \n> Is there a better way than making several (recursive) copies of the\n> repository, deleting all but one directory in each copy, then moving the\n> contents of that directory up a level? (And perhaps setting up a Git\n> superproject at the original location. I do know about that.)\n\nRewrite the history of each directory with git-filter-branch. It even\nhas a \"--subdirectory-filter\" option that will do exactly what you want.\n\n-Peff\n"},{"id":"157294","messageId":"4CF9DD5E.7020400@cs.wisc.edu","threadId":"25948","inReplyTo":"20101204053304.GA7311@sigill.intra.peff.net","subject":"Re: Splitting up a repository","fromName":"Evan Driscoll","fromEmail":"driscoll@cs.wisc.edu","sentAt":"2010-12-04T06:19:10Z","receivedAt":"2010-12-04T06:19:10Z","isPatch":false,"sender":{"key":"driscoll@cs.wisc.edu","avatar":null},"body":"On 12/3/2010 23:33, Jeff King wrote:\n>> Is there a better way than making several (recursive) copies of the\n>> repository, deleting all but one directory in each copy, then moving the\n>> contents of that directory up a level? (And perhaps setting up a Git\n>> superproject at the original location. I do know about that.)\n> \n> Rewrite the history of each directory with git-filter-branch. It even\n> has a \"--subdirectory-filter\" option that will do exactly what you want.\n\nGreat, thanks. I had to mess around with a submodule that was inside one\nof the subdirectories that didn't make it through the history rewrite,\nand I could see that have getting slightly hairy, but at least in my\ncase it was pretty simple. Other than that, worked like a charm.\n\nEvan\n\n"},{"id":"157296","messageId":"AANLkTikqnnOLN=asPUKK0zYxYK9VWXcZPBPtwMZ3z-cr@mail.gmail.com","threadId":"25948","inReplyTo":"4CF9D15D.7090001@cs.wisc.edu","subject":"Re: Splitting up a repository","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-04T07:09:15Z","receivedAt":"2010-12-04T07:09:15Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:\n> Say I have a repo where there are directories repo/foo, repo/bar,\n> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough\n> that I put them together initially, but loosely enough that I now wish I\n> could check out just 'repo/foo'. Since Git doesn't support partial\n> checkouts (a bit annoying!),\n\nUm.. it does support partial checkouts (check out man page of\ngit-read-tree, sparse checkout section). But you must do a full clone\n(i.e. your repository will have bar and baz, even if you only checkout\nfoo).\n-- \nDuy\n"},{"id":"157295","messageId":"4CF9EA60.7040402@cs.wisc.edu","threadId":"25948","inReplyTo":"AANLkTikqnnOLN=asPUKK0zYxYK9VWXcZPBPtwMZ3z-cr@mail.gmail.com","subject":"Re: Splitting up a repository","fromName":"Evan Driscoll","fromEmail":"driscoll@cs.wisc.edu","sentAt":"2010-12-04T07:14:40Z","receivedAt":"2010-12-04T07:14:40Z","isPatch":false,"sender":{"key":"driscoll@cs.wisc.edu","avatar":null},"body":"On 12/4/2010 1:09, Nguyen Thai Ngoc Duy wrote:\n> On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:\n>> Say I have a repo where there are directories repo/foo, repo/bar,\n>> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough\n>> that I put them together initially, but loosely enough that I now wish I\n>> could check out just 'repo/foo'. Since Git doesn't support partial\n>> checkouts (a bit annoying!),\n> \n> Um.. it does support partial checkouts (check out man page of\n> git-read-tree, sparse checkout section). But you must do a full clone\n> (i.e. your repository will have bar and baz, even if you only checkout\n> foo).\n\nThat's sort of spiffy, and I did not know about that. So again, thanks.\n\nThat said, I did a bit of reading around, and I'm not sure it does what\nI need.\nhttp://stackoverflow.com/questions/2336580/sparse-checkout-in-git-1-7-0\nis basically what I want, and the answers seem to indicate it isn't\npossible. (In other words, in my example, when I want a checkout of\nrepo/foo, the .git directory needs to be a sibling of foo's contents,\nnot a sibling of foo.)\n\nEvan\n\n"},{"id":"157297","messageId":"AANLkTinLFZTFgov9RtNTFS36BV0xyTm6=kpDE3VZFcEG@mail.gmail.com","threadId":"25948","inReplyTo":"4CF9EA60.7040402@cs.wisc.edu","subject":"Re: Splitting up a repository","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-04T07:41:45Z","receivedAt":"2010-12-04T07:41:45Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Dec 4, 2010 at 2:14 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:\n> On 12/4/2010 1:09, Nguyen Thai Ngoc Duy wrote:\n>> On Sat, Dec 4, 2010 at 12:27 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:\n>>> Say I have a repo where there are directories repo/foo, repo/bar,\n>>> repo/baz. 'foo', 'bar', and 'baz' are loosely related -- closely enough\n>>> that I put them together initially, but loosely enough that I now wish I\n>>> could check out just 'repo/foo'. Since Git doesn't support partial\n>>> checkouts (a bit annoying!),\n>>\n>> Um.. it does support partial checkouts (check out man page of\n>> git-read-tree, sparse checkout section). But you must do a full clone\n>> (i.e. your repository will have bar and baz, even if you only checkout\n>> foo).\n>\n> That's sort of spiffy, and I did not know about that. So again, thanks.\n>\n> That said, I did a bit of reading around, and I'm not sure it does what\n> I need.\n> http://stackoverflow.com/questions/2336580/sparse-checkout-in-git-1-7-0\n> is basically what I want, and the answers seem to indicate it isn't\n> possible. (In other words, in my example, when I want a checkout of\n> repo/foo, the .git directory needs to be a sibling of foo's contents,\n> not a sibling of foo.)\n\nIf you want different layout too, then no it does not do that.\nSplitting repo is probably best.\n-- \nDuy\n"}]}