如何在存储库上使用svn2git [英] How to use svn2git on repository
问题描述
我正在使用 svn2git 测试svn存储库到git的迁移.现在,我的svn就是这样构建的
I'm using svn2git to test the migration of an svn repo to a git. Now my svn is build like thise
myproj
包含
repo1 /
repo2 (obsolete)/
old/
每个回购都包含自己的分支,标签等.我只需要repo1中的所有内容.当我开始该过程时,我得到以下信息:
Every repo contains its own branches, tags etc. I only need everything which is in repo1. When I start the process I get this:
svn2git https://server/myproj/repo1 --username LVO
输出:
Initialized empty Git repository in /folder/.git/
Using higher level of URL: https://server/myproj/repo1 => https://server/myproj
然后该过程开始.恐怕它也会占用所有其他旧仓库.这是启动它的正确方法吗?:
And than the process starts. I'm afraid it's taking all the other old repo's too. Is this the right way to start it?:
$ svn2git https://server/myproj/repo1 --username xxx --trunk=/repo1 --branches=/repo1 --tags=/repo1
(尤其是行李箱的东西对我来说还不清楚).当我的存储库在这棵树中时,我该如何启动svn2git.
(especially the trunk thing is not clear for me). How do I have to launch svn2git when my repo is in this tree.
推荐答案
对于一次性迁移 git-svn
不是不是用于转换存储库或转换存储库的正确工具.仓库的一部分.如果要将Git用作现有SVN服务器的前端,这是一个很好的工具,但是对于一次性转换,您应该不使用 git-svn
,而> svn2git
,它更适合此用例.
For a one-time migration git-svn
is not the right tool for conversions of repositories or parts of repositories. It is a great tool if you want to use Git as 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.
您使用的 svn2git
工具基于 git-svn
,因此存在大多数相同的缺点,只是修复了克隆后操作中的一些缺点.
The svn2git
tool you use is based on git-svn
and thus suffers from most of the same drawbacks, only fixing some in the post-clone actions.
有很多称为 svn2git
的工具,可能最好的一种是来自 https://github.com/svn-all-fast-export/svn2git .我强烈建议使用该 svn2git
工具.这是我所知道的最好的,它在处理规则文件方面非常灵活.
There are plenty tools called svn2git
, the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git. I strongly recommend using that svn2git
tool. It is the best I know available out there and it is very flexible in what you can do with its rules files.
您将能够轻松配置 svn2git
规则文件,以从当前的SVN布局(包括任何复杂的历史记录)中生成所需的结果.
You will be easily able to configure svn2git
s rule file to produce the result you want from your current SVN layout, including any complex histories.
如果您不是100%了解存储库的历史记录,请svnever > http://blog.hartwork.org/?p=763 是一个很好的工具,可以在将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.
即使更容易开始使用 git-svn
(或基于它的 svn2git
),这还是使用KDE 的一些其他原因除了灵活性之外,svn2git
优于 git-svn
:
Even though git-svn
(or the svn2git
that is based on it) is easier to start with, here are some further reasons why using the KDE svn2git
instead of git-svn
is superior, besides its flexibility:
- 通过
svn2git
(如果使用了正确的历史记录)可以更好,更清晰地重建历史记录,对于具有分支和合并等更复杂历史记录的情况尤其如此. - 标签是真实标签,不是Git中的分支
- 带有
git-svn
的标签包含一个额外的空提交,这也使它们不属于分支,因此常规的fetch
直到您给出-tags
到命令,默认情况下,也仅获取指向获取的分支的标记.带有正确的svn2git标签是它们所属的地方 - 如果您在SVN中更改了布局,则可以轻松地使用
svn2git
进行配置,而使用git-svn
最终会放弃历史记录 - 使用
svn2git
,您还可以轻松地将一个SVN存储库拆分为多个Git存储库 - 或将同一SVN根目录中的多个SVN存储库轻松组合到一个Git存储库中
- 使用正确的
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 - the tags are real tags and not branches in Git
- with
git-svn
the tags contain an extra empty commit which also makes them not part of the branches, so a normalfetch
will not get them until you give--tags
to the command as by default only tags pointing to fetched branches are fetched also. With the proper svn2git tags are where they belong - if you changed layout in SVN you can easily configure this with
svn2git
, withgit-svn
you will loose history eventually - with
svn2git
you can also split one SVN repository into multiple Git repositories easily - or combine multiple SVN repositories in the same SVN root into one Git repository easily
- the conversion is a gazillion times faster with the correct
svn2git
than withgit-svn
您看到, git-svn
较差而KDE svn2git
较优的原因很多.:-)
You see, there are many reasons why git-svn
is worse and the KDE svn2git
is superior. :-)
这篇关于如何在存储库上使用svn2git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!