简体   繁体   中英

Best way to convert from svn to git while merging repositories?

svn-all-fast-export looks to be a great way to move from svn to git and it supports splitting one svn repository into multiple git repositories.

I want to do the opposite. I have a set of closely-related svn repositories. They all branch at the same time with the same branch names. Tagging is the same across all repositories. I want to combine them into one git repository, with the files from each svn repository in its own subdirectory. I want the histories interleaved so that, for example, commits to trunk in each repository appear on master in git in date order.

More concretely, I have svn repositories with trunk commits shown numbered in time order (commits on each branch look similar):

A
  commit 1
  commit 4
B
  commit 2
  commit 3
  commit 8
C
  commit 5
  commit 6
  commit 7

I'd like to convert to the following in git:

bigproject/
  A/
  B/
  C/

With a history on master that looks like:

commit 1
commit 2
commit 3
commit 4
commit 5
commit 6
commit 7
commit 8

Can svn-all-fast-export do this? I haven't found any examples of it. Is there another existing tool to do it?

I have used SubGit on a previous project for performing a Subversion to Git migration that was slightly simpler than what you are trying to accomplish. Personally, I tried using several migration tools before SubGit, and was pleasantly surprised with the overall usability and common sense configuration options.

The following post also has some ideas how you can leverage a tool like SubGit to accomplish your task: https://serverfault.com/questions/420828/migrate-multiple-svn-repositories-into-single-git-repository . But once again, I would definitely suggest SubGit over something like the git-svn bridge that comes built into git (which seems to be extremely fragile at times) for the basic migration tasks.

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