2010-09-28 150 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