简体   繁体   English

从SVN迁移到GIT

[英]Migrating from SVN to GIT

Migrating svn to git. 将svn迁移到git。 Project structure is as follows svn.dcit.company.com/dcit/projectname/featurename/branches/branch1 项目结构如下svn.dcit.company.com/dcit/projectname/featurename/branches/branch1

Now I have been trying to do git svn clone for branch1 for the whole day to no success. 现在我一直试图为branch1做git svn clone整天都没有成功。 I have tried everything from git svn clone http.../branch1 to all hacks mentioned on internet. 从git svn clone http ... / branch1到互联网上提到的所有hack,我都尝试了所有方法。

Everytime I get this error "W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: '...path not found" IT does end up getting some files, but those are from similarly named but wrong project! 每当我收到此错误“ W:忽略SVN中的错误,路径可能不存在:(160013):文件系统没有任何项:'... path not found” IT最终会获取一些文件,但是这些文件来自相似的名称但是错误的项目! Please HELP 请帮忙

For a one-time migration git-svn is not the right tool for conversions of repositories or repository parts. 对于一次性迁移, git-svn 不是用于转换存储库或存储库部件的正确工具。 It is a great tool if you want to use Git as a frontend for an existing SVN server, but for one-time conversions you should not use git-svn , but svn2git which is much more suited for this use-case. 这是一个伟大的工具,如果你想使用的Git为现有SVN服务器前端,但对于一次性转换,你应该使用git-svn ,但svn2git这是该用例更加适合。

There are plenty tools called svn2git , the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git . 有很多名为svn2git工具,最好的一种可能是来自https://github.com/svn-all-fast-export/svn2git的KDE工具。 I strongly recommend using that svn2git tool. 我强烈建议您使用该svn2git工具。 It is the best I know available out there and it is very flexible in what you can do with its rules files. 这是我所知道的最好的,它可以很灵活地处理其规则文件。

You will be easily able to configure svn2git s rule file to produce the result you want from your current SVN layout. 您将可以轻松配置svn2git的规则文件,以从当前SVN布局中生成所需的结果。 You can even produce multiple Git repositories from your various projects in SVN in one run. 您甚至可以一次运行从SVN中的各个项目中生成多个Git存储库。

If you are not 100% about the history of your repository, svneverever from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of an SVN repository when migrating it to Git. 如果您不是100%知道存储库的历史记录,请从http://blog.hartwork.org/?p=763中 svneverever ,这是在将SVN存储库迁移到Git时调查其历史记录的绝佳工具。


Even though git-svn is easier to start with, here are some further reasons why using the KDE svn2git instead of git-svn is superior, besides its flexibility: 尽管开始使用git-svn更容易,但是还有以下一些原因,为什么使用KDE svn2git代替git-svn更具优势:

  • the history is rebuilt much better and cleaner by svn2git (if the correct one is used), this is especially the case for more complex histories with branches and merges and so on svn2git (如果使用了正确的历史记录)可以更好,更干净地重建历史记录,对于具有分支和合并等更复杂历史记录的情况尤其如此
  • the tags are real tags and not branches in Git 标签是真实标签,不是Git中的分支
  • with git-svn the tags contain an extra empty commit which also makes them not part of the branches, so a normal fetch will not get them until you give --tags to the command as by default only tags pointing to fetched branches are fetched also. 使用git-svn标签会包含一个额外的空提交,这也会使它们不成为分支的一部分,因此,除非您将--tags交给命令, --tags正常的fetch将不会获取它们,因为默认情况下,还会仅获取指向获取的分支的标签。 With the proper svn2git tags are where they belong 带有正确的svn2git标签是它们所属的位置
  • if you changed layout in SVN you can easily configure this with svn2git , with git-svn you will loose history eventually 如果您在SVN中更改了布局,则可以轻松地使用svn2git配置,而使用git-svn最终会丢失历史记录
  • with svn2git you can also split one SVN repository into multiple Git repositories easily 使用svn2git您还可以轻松地将一个SVN存储库拆分为多个Git存储库
  • or combine multiple SVN repositories in the same SVN root into one Git repository easily 或将同一SVN根目录中的多个SVN存储库轻松组合到一个Git存储库中
  • the conversion is a gazillion times faster with the correct svn2git than with git-svn 正确的svn2gitgit-svnsvn2git

You see, there are many reasons why git-svn is worse and the KDE svn2git is superior. 您会看到git-svn较差而KDE svn2git较差的原因很多。 :-) :-)

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

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