如何使用git-svn来切换svn仓库? [英] How to switch svn repositories using git-svn?

查看:128
本文介绍了如何使用git-svn来切换svn仓库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git-svn创建了许多使用SVN存储库克隆的git项目。我们已经将我们的SVN存储库迁移到新的提供商,所以URL现在已经改变。我如何更新我的git克隆的远程SVN URL?

一种可能性是我从新的SVN仓库重新克隆,但我不想这样做,因为整个历史过程可能需要几天的时间。

另一种解决这个问题的方法是,git会在哪里存储关于您正在使用的远程SVN仓库位置的信息?即当你输入'git svn info'时,URL信息来自哪里?

解决方案

我在git wiki中找到了一个页面完全回答我的问题:



https ://git.wiki.kernel.org/index.php/GitSvnSwitch



  • 编辑在.git / config中指向新域名的svn-remote url URL
  • 运行git svn fetch - 这需要至少从svn获取一个新版本!

  • 将svn-remote url更改回原始URL

  • 运行git svn rebase -l来执行本地rebase(使用上次获取时所做的更改操作)

  • 将svn-remote url更改回新的url

  • 运行git svn rebase现在应该可以重新使用! b


如果git svn fetch步骤实际上获取了
任何东西,这只会起作用! (花了我一段时间才发现......我必须在svn仓库中放入一个虚拟的
版本才能实现!)



I have a number of git projects created as clones of SVN repositories using git-svn. We have migrated our SVN repositories to a new provider so the URL has now changed. How can I update the remote SVN URL of my git clone?

One possibility is that I re-clone from the new SVN repository but I'd prefer not to do that as the process can take days when pulling in the entire history.

Another way to put this question would be, where does git store information about the location of the remote SVN repository you're working with? I.e. where does the URL information come from when you type 'git svn info'?

解决方案

I found a page in the git wiki which answers exactly my question:

https://git.wiki.kernel.org/index.php/GitSvnSwitch

  • Edit the svn-remote url URL in .git/config to point to the new domain name
  • Run git svn fetch - This needs to fetch at least one new revision from svn!
  • Change svn-remote url back to the original url
  • Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation)
  • Change svn-remote url back to the new url
  • Run git svn rebase should now work again!

This will only work, if the git svn fetch step actually fetches anything! (Took me a while to discover that... I had to put in a dummy revision to our svn repository to make it happen!)

这篇关于如何使用git-svn来切换svn仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆