简体   繁体   English

将SVN存储库的子文件夹迁移到git

[英]Migrate subfolders of SVN repo to git

Is it possible to migrate only a part of a SVN repo to Git? 是否可以仅将SVN存储库的一部分迁移到Git? Note that I have to migrate more than one folder located in the root, but not all of them. 请注意,我必须迁移根目录中的多个文件夹,但不是全部。 For example given the following repo: 例如,给出以下回购:

REPO_ROOT
- FOLDER_A
- FOLDER_B
- FOLDER_C
- FOLDER_D

I want to migrate to the Git repo only FOLDER_B and FOLDER_C 我只想迁移到Git FOLDER_BFOLDER_C

Yes. 是。 You have to clone from URL of your folder and (for Git 1.6.4+) use (except others) option --no-minimize-url 您必须从文件夹的URL克隆,并且(对于Git 1.6.4+)使用(其他除外)选项--no-minimize-url

git svn clone --prefix=svn/ --authors-file=authors.txt --no-minimize-url http://PEPO/PATH/TO/FOLDER/ ...

I found a convenient solution: 我找到了一个方便的解决方案:

  1. Clone that part of the SVN you'd like 克隆您想要的SVN部分
  2. Go to the root folder of your git repo 转到git仓库的根文件夹
  3. Type git remote add -f tmp_repo PATH_OF_THE_SVN_CONE 键入git remote add -f tmp_repo PATH_OF_THE_SVN_CONE
  4. Type git merge -s ours –no-commit tmp_repo/master 输入git merge -s ours –no-commit tmp_repo/master
  5. Type git read-tree –prefix=Demo/Kinect -u Kinect/master 键入git read-tree –prefix=Demo/Kinect -u Kinect/master
  6. Commit 承诺
  7. Check that everything is ok 检查一切正常
  8. Push
  9. Type git remote remove tmp_repo 键入git remote remove tmp_repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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