简体   繁体   English

将存储库从git转换为subversion

[英]Converting a repository from git to subversion

Reasons for doing this aside, is there a reasonable way to convert an entire git repository to subversion ? 除此之外,有没有合理的方法将整个git存储库转换为subversion

I can find only tons on information on migrating from subversion to git, and exchanging changesets between the two, but not for doing a simple conversion of the entire git repository to svn. 我只能找到有关 subversion迁移 git以及在两者之间交换更改集的信息,但不能将整个git存储库的简单转换为svn。

The general problem with doing conversions this direction is that Git repositories can contain more than just a linear history of revisions, as Subversion would expect. 转换这个方向的一般问题是,Git存储库可以包含的不仅仅是修订版的线性历史记录,正如Subversion所期望的那样。 Multiple ancestries with divergent histories and frequent merge commits are all possible, which can't be easily represented in a Subversion repository. 具有不同历史和频繁合并提交的多个祖先都是可能的,这在Subversion存储库中无法轻易表示。

For simple cases where you do have a linear history in your Git repository, you can use git-svn dcommit to push the lot up to an otherwise empty Subversion repository. 对于Git存储库中确实存在线性历史记录的简单情况,您可以使用git-svn dcommit将批次推送到其他空的Subversion存储库。

It's very easy to perform with SubGit . 使用SubGit非常容易。

$ svnadmin create svn.repo
$ subgit configure svn.repo
$ nano svn.repo/conf/subgit.conf to specify a path to your bare repository (you may use "git clone --bare <URL>" if you have none locally)
$ subgit install svn.repo

After conversion your SVN and linked Git repository will be in sync: every Git push will be translated to SVN commit and vice versa. 转换后,您的SVN和链接的Git存储库将保持同步:每个Git推送都将转换为SVN提交,反之亦然。 To break translation run 打破翻译运行

$ subgit uninstall svn.repo

While translation SubGit will try to preserve commit dates, tags, ignores, merges, EOLs, branches and so on, as it is possible. 虽然翻译SubGit会尽可能地保留提交日期,标签,忽略,合并,EOL,分支等。 I can't say the same about git-svn repository. 我不能对git-svn存储库说同样的话。

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

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