从svn到git,带有移动的主干 [英] From svn to git, with a moved trunk

查看:153
本文介绍了从svn到git,带有移动的主干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的svn存储库切换到git。这是一个旧版本库,以前的维护者之一为每个新版本都移动了主干。例如,以前的存储库位于:


  • svn + ssh://svn.mycompany.com/project/release_1/trunk

    li>


现在,我们目前的中继线位于:


  • svn + ssh://svn.mycompany.com/project/release_N/trunk



当我检出SVN第二个存储库时,我有完整的历史,包括在复制之前。但是,当我git-svn第二个存储库时,我没有旧的历史记录(从release_1,...)。第一个提交是 release_ {N-1} release_N / trunk

$ b的副本
$ b

这是我试过的:


  • git svn clone --no-minimize-url --authors -file my-authors-file svn + ssh://svn.mycompany.com/project/release_N/trunk my_project.git



由于这不起作用,我尝试了其他方法。我们假设'copy commit'是K,我试过了:


  • git svn clone --no-minimize-url -r BASE: K --authors-file my-authors-file svn + ssh://svn.mycompany.com/project/release_N/trunk my_project.git



这次git-svn没有找到任何提交。

你知道是否有一种魔术来获得完整的历史记录?

解决方案

这就是我所理解的问题:

您的历史传遍了几个svn分支(发生所有被称为中继)。
当你转移到git时,你会喜欢所有这些历史记录。



我认为以下内容可以解决您的问题:

  git svn init my_project.git 

git config svn-remote.svn.url svn + ssh://svn.mycompany.com/project
git config svn-remote.svn.fetch release_N / trunk:refs / remotes / trunk
git config svn-remote.svn.branches * / trunk:refs / remotes / *
git config svn.authorsfile my-authors-file

git svn fetch

这会创建release_N分支作为主干,剩余的发布作为你git仓库中不同的分支。



据我所知,你不能得到一个git svn分支指向多个网址,这正是我认为你想要做的。


I'm trying to switch my svn repository to git. It's an old repository, and one of the previous maintainer moved the trunk for each new release. For example, the previous repository was at:

  • svn+ssh://svn.mycompany.com/project/release_1/trunk

Now, our current trunk is at:

  • svn+ssh://svn.mycompany.com/project/release_N/trunk

When I checkout the SVN second repository, I've the full history, including before the copy. However when I git-svn the second repository, I don't have the old history (from release_1, ...). The first commit is the copy of release_{N-1} to release_N/trunk.

Here is what I tried:

  • git svn clone --no-minimize-url --authors-file my-authors-file svn+ssh://svn.mycompany.com/project/release_N/trunk my_project.git

Since this does not work, I tried something else. Let's assume that the 'copy commit' is K, I tried:

  • git svn clone --no-minimize-url -r BASE:K --authors-file my-authors-file svn+ssh://svn.mycompany.com/project/release_N/trunk my_project.git

This time git-svn does not find any commit.

Do you know if there is a magic trick to have the full history ?

解决方案

This is what I've understood by the question:
You have your history spread across several svn branches (which happen to all be called trunk). You would like all of this history when moving to git.

I think the following will fix your problem:

git svn init my_project.git

git config svn-remote.svn.url svn+ssh://svn.mycompany.com/project
git config svn-remote.svn.fetch release_N/trunk:refs/remotes/trunk
git config svn-remote.svn.branches */trunk:refs/remotes/*
git config svn.authorsfile my-authors-file

git svn fetch

This will create the release_N branch as trunk, and the remaining releases as different branches in your git repository.

As far as I know, you can't get one git svn branch to point at multiple urls, which is what I think you were trying to do.

这篇关于从svn到git,带有移动的主干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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