{"thread":{"id":"8018","subject":"git-svn: importing branches later","startedAt":"2007-05-07T19:07:06Z","lastAt":"2007-05-08T15:34:29Z","messageCount":4,"participants":["Michael Hendricks","Karl Hasselström","Seth Falcon"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"41351","messageId":"20070507190702.GE342@ginosko.local","threadId":"8018","inReplyTo":null,"subject":"git-svn: importing branches later","fromName":"Michael Hendricks","fromEmail":"michael@ndrix.org","sentAt":"2007-05-07T19:07:06Z","receivedAt":"2007-05-07T19:07:06Z","isPatch":false,"sender":{"key":"michael@ndrix.org","avatar":"https://gravatar.com/avatar/315311e6daa79f24e5648f9534420c24ec48eada42efd4110f1d17167ff44fa8?d=mp&s=160"},"body":"I've cloned the trunk of a SVN repository using git-svn and now I want\nto bring in just a couple of the branches from the same repository.\nI've not been able to discover anything that works.  Basically, I've\ndone this\n\n$ git svn clone $URL -T trunk git-repo\n\nNow I want to import the 'foo' branch from the same SVN repo without\ngrabbing all the branches.  Any suggestions?\n\nThanks.\n\n-- \nMichael\n"},{"id":"41429","messageId":"20070508085149.GB24409@diana.vm.bytemark.co.uk","threadId":"8018","inReplyTo":"20070507190702.GE342@ginosko.local","subject":"Re: git-svn: importing branches later","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-05-08T08:51:49Z","receivedAt":"2007-05-08T08:51:49Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:\n\n> Now I want to import the 'foo' branch from the same SVN repo without\n> grabbing all the branches. Any suggestions?\n\nI seem to recall that just adding another \"fetch\" line to the git-svn\nconfiguration in .git/config will do this for you.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"41456","messageId":"m2odkv2wtd.fsf@ziti.local","threadId":"8018","inReplyTo":"20070508085149.GB24409@diana.vm.bytemark.co.uk","subject":"Re: git-svn: importing branches later","fromName":"Seth Falcon","fromEmail":"sethfalcon@gmail.com","sentAt":"2007-05-08T14:51:10Z","receivedAt":"2007-05-08T14:51:10Z","isPatch":false,"sender":{"key":"sethfalcon@gmail.com","avatar":"https://gravatar.com/avatar/fd62fe73d3013b12fce71d5269ec52eaca3c4cee479efc6eea3603d6f1d8bf8d?d=mp&s=160"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:\n>\n>> Now I want to import the 'foo' branch from the same SVN repo without\n>> grabbing all the branches. Any suggestions?\n>\n> I seem to recall that just adding another \"fetch\" line to the git-svn\n> configuration in .git/config will do this for you.\n\nYes, this should work.  As long as you started out with a fairly\nrecent git (sorry, I don't know how recent is needed) you should have\nin your repository a git/config file containing something like:\n\n    [svn-remote \"svn\"]\n    \turl = http://main.svn.url.com/\n    \tfetch = trunk:refs/remotes/git-svn\n    \tfetch = branches/b1:refs/remotes/b1  <-- this line added by you\n\nThen a 'git svn fetch' should pull it all down and you can checkout\nthe branch using 'git checkout -b myb1 remotes/b1'.  At this point,\n'git svn rebase' is smart enough to know where the branch comes from.\n\nWhat may not work when you add branches in this way is that the\nhistory may not connect with the actual branch commit in svn.  I'm\nfairly sure there is some way to fix that, but I haven't done it.\n\n+ seth\n"},{"id":"41471","messageId":"20070508153428.GB5349@ginosko.local","threadId":"8018","inReplyTo":"m2odkv2wtd.fsf@ziti.local","subject":"Re: git-svn: importing branches later","fromName":"Michael Hendricks","fromEmail":"michael@ndrix.org","sentAt":"2007-05-08T15:34:29Z","receivedAt":"2007-05-08T15:34:29Z","isPatch":false,"sender":{"key":"michael@ndrix.org","avatar":"https://gravatar.com/avatar/315311e6daa79f24e5648f9534420c24ec48eada42efd4110f1d17167ff44fa8?d=mp&s=160"},"body":"On Tue, May 08, 2007 at 07:51:10AM -0700, Seth Falcon wrote:\n> Karl Hasselström <kha@treskal.com> writes:\n> \n> > On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:\n> >\n> >> Now I want to import the 'foo' branch from the same SVN repo without\n> >> grabbing all the branches. Any suggestions?\n> >\n> > I seem to recall that just adding another \"fetch\" line to the git-svn\n> > configuration in .git/config will do this for you.\n> \n> Yes, this should work.  As long as you started out with a fairly\n> recent git (sorry, I don't know how recent is needed) you should have\n> in your repository a git/config file containing something like:\n> \n>     [svn-remote \"svn\"]\n>     \turl = http://main.svn.url.com/\n>     \tfetch = trunk:refs/remotes/git-svn\n>     \tfetch = branches/b1:refs/remotes/b1  <-- this line added by you\n\nThanks Seth and Karl, that does indeed work.\n\nI noticed that after changing .git/config and running fetch, git-svn\nretrieves the log for the entire project (presumably because it doesn't\nknow when the new branch was created).  In one project with ~30,000\nrevisions, I found it beneficial to specify \"git svn fetch -r\n12345:HEAD\" where revision 12345 is somewhere close to and before the\npoint at which the new branch was created from trunk.  That makes the\ninitial fetch must faster.\n\n-- \nMichael\n"}]}