简体   繁体   中英

Can I git-svn clone an svn repo with multiple standard directory layouts

I have an SVN repo with a layout like
project1/trunk
project1/branches
project1/tags
project2/trunk
project2/branches
project2/tags
etc.

For a number of reasons, I'd like a git-svn repo that allows me to work on any of these projects and fetch/dcommit from/to all of them at once. Is this kind of thing possible? I know I could just git-svn clone the whole thing without specifying branches, tags, and trunk, but then I'd lose a lot of the advantage of using git.

This is how I did it. There may be simpler ways, though.

  1. Select the first project with the standard layout you'd like to work on and git svn clone it:

    git svn clone --stdlayout http://sample.com/svn/repository-name/project-name repository-name

  2. Go into the repository-name directory and edit its .git/config file. You could also do this with git-config commands, but I find it easier in a text editor.

  3. You'll see an [svn-remote "svn"] section already defined for your first project. Rename the svn-remote to something more unique than "svn" , probably the same as your project name. Eg, [svn-remote "project-name"] .

  4. Make more [svn-remote "project-name"] sections for each project, following the template of the first one. Give each one a unique name! You'll need to change the fetch , branches , and tags settings to use the correct Subversion directory names for each project.

  5. Once you're done, save your file and run git svn fetch --fetch-all . The other projects will be fetched as remotes in your local repository.

  6. To switch your master between projects, do a git reset --hard other-project-name/trunk , just like if you were switching to work on any other remote Subversion branch.

要解决同时签出多个项目的问题,可以使用git-new-workdir从同一个git存储库中检出多个工作目录,请参阅https://github.com/git/git/blob/master/contrib / WORKDIR /混帐新WORKDIR

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM