2011-09-18 144 views
1

我使用git在本地機器上開發當前項目。 存在一個顛覆服務器,我必須不時更新,基於我當前的主分支。git svn部分顛覆樹

比方說我在SVN目錄是:

project/module/ 

在這個目錄下有一個總目錄,我的svn結構

project/module/aDirectory 
project/module/myGitDirectory/trunk 
project/module/myGitDirectory/branches 
project/module/myGitDirectory/tags 

繼混帳svn的設置我的git使用目錄作爲上游:

[svn-remote "svn"] 
     url = https://mygit.test.com/project 
     fetch = module/myGitDirectory/trunk:refs/remotes/trunk 
     branches = module/myGitDirectory/branches/*:refs/remotes/* 
     tags = module/myGitDirectory/tags/*:refs/remotes/tags/* 

我在git中正常工作,並提交我的更改j UST與

git svn dcommit 

到局部SVN樹

這個工作相當精細,等到有人在

project/module/aDirectory 

這是不是在我的本地混帳回購協議承諾。

的失敗爲git svn dcommit是:

Unable to determine upstream SVN information from HEAD history. 

我用Google搜索這個問題,並因此在這裏找到了一些解決方案,但方案並沒有真正幫助我。要麼它根本沒有工作,要麼我不得不手動幾十個文件,這是我不想要的。 我目前的解決方法是簽出完整的svn,將副本從git複製到svn repo並提交它們。

所以我的問題是,是否有可能使用這樣的混帳SVN內的部分SVN樹,我的方式? 通過爲git-svn指定錯誤的目錄,我犯了什麼錯誤? 或者是git-svn不適合我的場景。

,如果我能做到這一點,我開始的方式,有什麼用SVN發生承諾未在我的本地git的跟蹤文件?

我使用SVN和Git的組合,在其他一些項目中,從來沒有遇到任何麻煩,但整個SVN樹在Git中進行管理。所以每個提交給svn在我的git repo中都有一個合適的位置:)

回答

0

這很奇怪。但是你可以克隆一個目錄來混帳。剛剛從SVN

git svn fetch svn-extra 

添加該到配置

[svn-remote "svn-extra"] 
     url = https://mygit.test.com/project 
     fetch = aGitDirectory:refs/remotes/aDirectory 

這個克隆a目錄後,並試圖讓前一個新的一個已經在你的回購

git svn fetch --fetch-all 

也許這可以幫助git-svn理解這種非典型的提交。

+0

我會試試看。我必須設置一個svn + git組合進行測試。我不想搞亂我的製作環境:) – evildead