简体   繁体   English

我可以将SVN存储库用作GIT存储库的源吗

[英]Can I have an SVN Repo as a source for a GIT Repo

I have a project in an SVN source, which will have to be migrated to a Git repository. 我在SVN源代码中有一个项目,该项目必须迁移到Git存储库。 What I'd like to do is committing all changes to Git repo from now on, while still fetching eventual changes from SVN, until it's dismissed. 我想做的是从现在开始将所有更改提交到Git存储库,同时仍然从SVN获取最终更改,直到将其撤消为止。

At the moment, I created the Git Repo, used git svn to clone it from the original SVN and pushed everything into Git. 此刻,我创建了Git Repo,使用git svn从原始SVN克隆它,并将所有内容推送到Git中。 Issue is, if I do a Pull, I'm fetching the modifications from Git, which is not what I want. 问题是,如果执行“拉”操作,我将从Git获取修改,这不是我想要的。

In practice, I'm trying to "fork" the SVN repository into Git and tracking SVN changes. 在实践中,我试图将SVN存储库“分叉”到Git中并跟踪SVN更改。 Is it possible to do that? 有可能这样做吗?

Thanks in advance for the answers. 预先感谢您的回答。

Yes you can do that, in your git repo, the master branch is tracking git-svn so when you run git svn rebase it updates master with the content in SVN. 是的,您可以这样做,在您的git repo中, master分支正在跟踪git-svn因此当您运行git svn rebase它将用SVN中的内容更新master In this same repository you can have another branch which merges regularly master but contains modifications that will not be sent back to SVN. 在同一存储库中,您可以有另一个分支,该分支定期合并master但是包含不会发送回SVN的修改。

While migrating from svn to git we have the same workflow than described in this answer . 从svn迁移到git时,我们的工作流程与此答案中所述的工作流程相同。

Currently, there is git svn rebase , as mentioned, which will allow you to get upstream changes from svn . 如前所述,当前有git svn rebase ,它将使您能够从svn获得上游更改。

Note that there is currently a GSoC project for adding svn remotes. 请注意,当前有一个用于添加svn遥控器的GSoC项目。 Its on its fifth version of the patch series at the moment. 目前是补丁程序系列的第五版。

git svn rebase will cause you extreme problems, though, for example if you push to a public repository and git svn rebase . git svn rebase会给您带来极大的问题,例如,如果您推送到公共存储库并使用git svn rebase For this reason you cannot push changes not in svn to the main git repository. 因此,您不能将不在svn中的更改推送到主git存储库。

If you want to use Git while letting 3rd parties to use your SVN repository, you can simply use any transparent Git<->SVN gateway, like SubGit . 如果要在允许第三方使用SVN存储库的同时使用Git,则可以简单地使用任何透明的Git <-> SVN网关,例如SubGit You will continue with Git forgetting about SVN, and SVN-users will never know you have a Git interface. 您将继续使用Git忘记SVN,并且SVN用户将永远不会知道您拥有Git界面。

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

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