简体   繁体   中英

How can I make git-svn repos for a large number of projects in the same SVN repository?

I've got a SVN repository that looks something like:

\project1
 - branches
 - tags
 - trunk
\project2
 - branches
 - tags
 - trunk
\subfolder
  \project3
    - branches
    - tags
    - trunk
   \another-subfolder
     \project4
       - branches
       - tags
       - trunk
etc

There's probably 100 projects or so in here. I'd like to create git-svn repos for each of these, preferably one that mirrors the structure of SVN.

My initial thought was to write a script that walk the SVN tree and do a git svn -d clone for each project, but I'm wondering if there's a better way to do this (or if someone's built a tool so I don't have to do it myself). Is this reasonable, or are there better ways to perform this task?

I wouldn't consider Split large Git repository into many smaller ones as a duplicate of this question, especially if you want to maintain the link between svn and your git repos, and be able to ' git svn dcommit ' back to the SVN repo.

You can use some tools like svn2git or svneverever , a Python tool which will help you detect all the right project directories in order to write a svn2git rules file for those.

The other approach is illustrated by this article (for multiple branches, but can be applied to multiple projects as well): "Git-SVN? No, Git+SVN".
Ie checkout the right part of your svn repo and initialize a git repo in it.
See also " Clone multiple SVN projects with git-svn " for an example of this approach .

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