开发者

How can you use git-svn to clone parts of an SVN repo, but still get all the branches

Is there any way to use git-svn to clone 开发者_高级运维only some folders of an SVN repo structure. I'm trying to clone a repo that has some crazy big binary files and a number of subfolders that are just plain useless. I've tried using the --ignore-paths option, but my clone seemed to just stall out doing nothing for an extremely long time. Have any of you managed to make --ignore-paths work? I can't find much on the webs where anyone else is running into this. Maybe I'm the only one.


We've used the "ignore-paths" feature to ignore certain directories in a svn repo:

[svn-remote "svn"]
        ignore-paths = ^(((branches|tags)/[^/]+|trunk)|)(huge/|mobile/)

This config ignores the "huge" and "mobile" subdirs of the repository in trunk, all branches and all tags.


Perhaps you can illustrate the structure of your Subversion repository to make it easier for us to suggest some solutions.

Are you trying to git svn clone the entire repository from the root-url? Have you tried cloning smaller parts of the repo, and then perhaps grafting several clones together?


The most success I've had here is to manually create branches in git that mirror the SVN remote repository when necessary. The process has been the following:

  1. Update .git/config file with:
 [svn-remote "svn-branch-alias"]
          url = http://svn/branches/crazybranchname/craziername/url/ 
          fetch = :refs/remotes/git-branch-name
  1. From the command line type: git svn fetch 'svn-branch-alias' to collect the SVN branch data into your local git repo.

  2. Then type: git checkout 'git-branch-name' to go into a headless mode.

  3. Finally type: git checkout 'my-local-git-branch-name' to create move head to the latest submission in that branch and create a local branch alias you can use.

You can now commit and dcommit as usual and still switch between various local git branches and your manually created SVN mirrors using the usual mechanisms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜