git-svn:什么等同于`svn switch --relocate`?

kch*_*kch 86 git version-control git-svn

我通过git-svn镜像的svn存储库改变了URL.

在vanilla svn你会做的svn switch --relocate old_url_base new_url_base.

我怎么能用git-svn做到这一点?

只需更改配置文件中的svn url就会失败.

kch*_*kch 60

这很好地处理了我的情况:

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

我使用file://协议克隆,并希望切换到http://协议.

编辑部分中的url设置很有吸引力,但就其自身而言这不起作用.通常,您需要遵循以下过程:[svn-remote "svn"].git/config

  1. 将svn-remote url设置切换为新名称.
  2. git svn fetch.这需要从svn获取至少一个新版本!
  3. 将svn-remote url设置更改回原始URL.
  4. 运行git svn rebase -l以执行本地rebase(使用上次提取操作所带来的更改).
  5. 将svn-remote url设置更改回新URL.
  6. 现在,git svn rebase应该再次工作.

冒险的灵魂可能想尝试--rewrite-root.

  • 公平地说,这实际上对我失败了,我最终重新克隆了回购.重命名svn目录时很难得到git来处理它. (2认同)
  • 以下是该程序的另一种描述:http://theadmin.org/articles/git-svn-switch-to-a-different-a-svn-url/ (2认同)
  • @TcMaster:也为我工作......但这就是为什么答案不应该包含*only*链接,它们已经过时并变得无用......我将添加一个社区wiki答案. (2认同)

H K*_*nan 35

您可以看到以下是否正常:

  1. 如果svn-remote.svn.rewriteRoot配置文件(.git/config)中不存在:

    git config svn-remote.svn.rewriteRoot <currentRepositoryURL>
    
    Run Code Online (Sandbox Code Playgroud)
  2. 如果svn-remote.svn.rewriteUUID配置文件中不存在:

    git config svn-remote.svn.rewriteUUID <currentRepositoryUUID>
    
    Run Code Online (Sandbox Code Playgroud)

    currentRepositoryUUID可以从获得.git/svn/.metadata.

  3. git config svn-remote.svn.url <newRepositoryURL>

  • 它对我也很有效,就像一种魅力。OP 应该尝试这个并得到它作为正确的答案。 (2认同)

Unc*_*eiv 21

不幸的是,这些答案中的大多数链接都不起作用,所以我将从git wiki中复制一些信息以供将来参考.

这个解决方案对我有用:

  • 编辑svn-remote url(或fetch路径).git/config以指向新域/ URL /路径

  • 运行git git svn fetch.这需要从svn获取至少一个新版本!

  • 如果您git svn rebase现在尝试,您将收到如下错误消息:

    Unable to determine upstream SVN information from working tree history
    
    Run Code Online (Sandbox Code Playgroud)

    我认为这是因为git svn您在获取之前的最新提交将git-svn-id指向旧路径这一事实感到困惑,旧路径与找到的旧路径不匹配.git/config.

  • 作为解决方法,将svn-remote url(或fetch路径)更改回原始域/网址/路径

  • 现在git svn rebase -l再次运行以使用上次提取操作所带来的更改来执行本地rebase.这一次它起作用,显然是因为git svn不会因git-svn-id新头部与发现的头部不匹配这一事实而混淆.git/config.

  • 最后,将svn-remote url(或fetch路径)更改回新域/ url/path

  • 此时git svn rebase应该再次工作!

原始信息在这里找到.