简体   繁体   中英

How to clone multiple SVN locations into a single Git repo

I've got an SVN repo that I want to move specific parts to a Git repo. Let's say the SVN repo has many directories under trunk but the only two I want to move across are:

  • trunk\\projectA
  • trunk\\projectB

I've successfully moved projectA by running the commands:

git svn clone http://svn-url.com/repo-name/trunk/projectA
git push git-url.com:/repo-name.git master

However, trying to run:

git svn clone http://svn-url.com/repo-name/trunk/projectB

Fails with the message:

svn-remote.svn.url already set: http://svn-url.com/repo-name/trunk/projectA wanted to set to: http://svn-url.com/repo-name/trunk/projectB

Anyone know how I can migrate multiple directories under trunk into a single Git repo?

I'm not sure if it matters but the Git repo is hosted in GitHub and the SVN repo is hosted by beanstalkapp.com.

TIA

You can use the --ignore-paths option to exclude directories that you don't want to have in your git repository:

git svn clone \
--ignore-paths='<regex>' \
http://svn-url.com/repo-name/trunk

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