简体   繁体   English

svn存储库移至git。 我正在使用git

[英]An svn repo moved to git. I was using git

So the situation is this. 情况就是这样。

  • There was an svn repository (open source) 有一个svn信息库(开源)
  • I cloned it using git-svn into my own repo (lets called B) and diverged a little, owner of svn repo wasnt interested in getting PR at the time. 我使用git-svn将其克隆到我自己的存储库(称为B)中,并稍有分歧,svn存储库的所有者当时对获取PR不感兴趣。
  • Finally the owner of the svn repo does move to git, lets call this repo C. The owner didn't keep the history when importing :( [FYI I did offer to transfer ownership of my repo] 最终,svn存储库的所有者确实移至git,我们将此存储库称为C。在导入时,所有者没有保留历史记录:( [仅供参考,我确实提供了转让我存储库的所有权]

I need to be able to inform my repo (B) that now we can pull from C from now on? 我需要能够通知我的仓库(B),现在我们可以从现在开始从C撤军了吗? Is there any good way to do this? 有什么好办法吗? I had a look at graph but found it pretty confusing. 我看了一下图,但发现它很混乱。

Thanks in advance for your help 在此先感谢您的帮助

You can keep both remotes in your repository, it's just that you'll have two independent branches in your repo: the git-svn old one, and the new one (since the new one won't be matched against git-svn one). 您可以将两个远程服务器都保留在存储库中,只是您的存储库中将有两个独立的分支:git-svn旧分支和新分支(因为新分支不会与git-svn匹配) 。

You'll be able to diff between them, push and pull to C, and rebase your current branches on it. 您将能够在它们之间进行区分,将其推到C并在其上重新建立当前分支。

Just change the remote URL and fetch it: 只需更改远程URL并获取它:

git remote set-url origin <new-url>
git fetch origin

You'll want to keep track of last SVN head with a tag, also. 您还将需要使用标签来跟踪最后一个SVN头。

You can try: 你可以试试:

git remote add neworigin /path/to/origin
git fetch neworigin
git checkout -b newmaster neworigin/master
git checkout master
git rebase newmaster
git branch --set-upstream master neworigin/master

I've not attempted this before in your situation and don't have any easy way of testing it but it seems like this should work. 在您遇到的情况下,我之前从未尝试过这种方法,也没有任何简单的方法可以对其进行测试,但是看来这应该可行。 If you reach that point and it all goes well you can remove the old remote and do a bit of house keeping like so (assuming the old remote was named "origin"): 如果达到了这一点并且一切顺利,则可以删除旧的遥控器,并像这样进行一些整理(假设旧遥控器名为“起源”):

git remote rm origin
git remote rename neworigin origin

Given that this is untested it may be worth attempting this on a disposable branch or a copy of the local repo. 鉴于未经测试,可能值得在一次性分支机构或本地存储库的副本上进行尝试。

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

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