简体   繁体   中英

How to move commits between repositories?

I have a bunch of commits applied to SVN repository, now I need to move them to git repository. I was thinking of applying the commits one by one using patches, but those patches use relative path that differs in both repositories, eg /trunk/project/src/main/java/... in svn and /project/src/main/java/... in git is there a way to create patches that have relative path to src/main, not trunk/project/src....

I wanted to add this as a comment but I do not have 50 reputation points, oh well. I believe the answer to your question can be found here:

How to migrate SVN repository with history to a new Git repository?

您应该使用svn clone

git svn clone <SVN_REPOSITORY_URL>

git svn doesn't work for me, it fails with some nasty errors: /usr/lib/perl/.... So I figured this issue the following way using IntelliJ IDEA:

  1. apply patches one by one
  2. in apply patch window I changed the folder hierarchy for each file in the initial commit
  3. changed the folder to the git folder.

But this approach is time-consuming

Have you try svn2git ? It's really a powerful tool based on git-svn. I have moved lots of svn repos to git repos using it. You may have a try to see if the perl error is still there.

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