如何从本地git分支创建一个svn分支?

时间:2010-09-28 20:39:20

标签: git branch git-svn

我正在使用git版本1.7.2.3,我有以下情况:

  Clone git repo from svn
  |
  *
  * (<= commits to master & corresponding commit to svn)
  *
  *
  |
  master (points to svn HEAD)
  |
  |___ my-branch (no equivalent svn branch)
        |
        *
        * (multiple commits to this branch)
        *
        *
        |
        (Current head of my-branch)

我想知道如何将git中的“Current head of my-branch”分支推送到svn(它还不存在)。

1 个答案:

答案 0 :(得分:2)

我建议这次使用先前省略的-s标志再次检查subversion存储库。首先在已设置的git repo上创建一个补丁:

$ git checkout my-branch
$ git format-patch master --stdout > my_branch.patch

然后在新创建的git存储库上应用补丁(git apply),该存储库知道subversion的tags和branches目录。因为git svn branch将完成这项工作。