2010-09-28 148 views
0

我使用Git版本1.7.2.3,我有以下情况:如何从本地git分支创建svn分支?

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

类型的副本http://stackoverflow.com/questions/2490794/git-svn-create-push-a-new-branch-tag,不是? – VonC 2010-09-28 20:41:25

+0

有点类似,但差异在于我遗漏的细节。当创建原始克隆时,我没有使用-s标志来执行浅拷贝。我刚克隆了树干。因为这个配置文件没有任何有关分支/标签的线索。 – yasouser 2010-09-28 22:46:29

+0

我只能想到关于解决方案的一个回合:1)用-s标志做另一个克隆。 2)按照这里列出的步骤:http://trac.parrot.org/parrot/wiki/git-svn-tutorial#TrackingSVNbrancheswithGIT。 – yasouser 2010-09-28 22:47:52

回答

2

我建议只需再次查看Subversion存储库,并使用之前省略的-s标志。首先对你已经设置的git回购创建一个补丁:

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

然后在新创建的Git仓库是知道的颠覆标签和分支目录的应用补丁(GIT适用)。为此git svn branch将完成这项工作。

+0

而不是手动合并,该修补程序可以很容易地工作。感谢您的回答。 – yasouser 2010-09-29 16:02:28