将存储库从 git 转换为 subversion

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/498110/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:34:21  来源:igfitidea点击:

Converting a repository from git to subversion

svngitversion-control

提问by dF.

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 fromsubversion togit, and exchanging changesets between the two, but not for doing a simple conversion of the entire git repository to svn.

我只能找到大量有关subversion迁移git 以及在两者之间交换变更集的信息,但不能将整个 git 存储库简单地转换为 svn。

采纳答案by Greg Hewgill

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. Multiple ancestries with divergent histories and frequent merge commits are all possible, which can't be easily represented in a Subversion repository.

在这个方向上进行转换的一般问题是 Git 存储库可以包含的不仅仅是修订的线性历史,正如 Subversion 所期望的那样。具有不同历史和频繁合并提交的多个祖先都是可能的,这在 Subversion 存储库中不容易表示。

For simple cases where you do have a linear history in your Git repository, you can use git-svn dcommitto push the lot up to an otherwise empty Subversion repository.

对于在 Git 存储库中确实有线性历史记录的简单情况,您可以使用git-svn dcommit将批次推送到否则为空的 Subversion 存储库。

回答by Dmitry Pavlenko

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. To break translation run

转换后,您的 SVN 和链接的 Git 存储库将同步:每次 Git 推送都将转换为 SVN 提交,反之亦然。中断翻译运行

$ 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. I can't say the same about git-svn repository.

而翻译 SubGit 将尽可能保留提交日期、标签、忽略、合并、EOL、分支等。我不能对 git-svn 存储库说同样的话。