1、從svn clone出項目,加上-s參數以標記識別svn標準的目錄分支結構,同時通過show-ignore設置git庫的exclude屬性:
- git svn clone -s https://svn.xxx.com/svn/xxx
- git svn show-ignore >> .git/info/exclude
2、建立本地工作分支,開始工作:
- git checkout -b work
修改內容直接commit,加上-a開頭以省略git add操作:
- git commit -a
3、提交回svn的過程:
- git checkout master
- git merge work
- git svn rebase
- git svn dcommit
在今天工作中,我提交回svn的方式是:
- git checkout master
- git svn rebase
- git merge work
結果svn rebase時在master分支上產生了一個新的node,這樣merge時就不能快速合并,出現了沖突,修復后,在dcommit時出錯,出現N個孤立節點。因為不熟悉,就checkout出work分支,進行了dcommit,然后重新生成一次git庫。
今天解決了這個問題,參考以下網址:https://wiki.bnl.gov/dayabay/index.php?title=Synchronizing_Repositories。
以下重新描述一下問題和解決方法:
1、在執行git svn dcommit時,出現如下錯誤:
Committing to https://svn.xxx.com/svn/projects/trunk ...
提交時發生合并沖突: 您的文件或目錄”test/functional/xxx_controller_test.rb“可能已經過時: The version resource does not correspond to the resource within the transaction. Either the requested version resource is out of date (needs to be updated), or the requested version resource is newer than the transaction root (restart the commit). at /usr/bin/git-svn line 450
2、這時,重新執行以下步驟即可:
- git svn fetch
- git svn rebase
- git svn dcommit
但我在執行git svn rebase時,又出現沖突,這個時候,只需要手工合并掉沖突,并重新add一下:
- git add .
然后,再執行:
- git rebase --continue
如果報告說沒有修改內容,則換成執行:
- git rebase --skip
完成rebase過程,這時就可以git svn dcommit了。
這樣,總算解決了svn歷史沖突問題,不用象前面那樣笨笨的重新git-svn clone.
posted on 2009-12-18 13:14
大日如來 閱讀(5734)
評論(1) 編輯 收藏 引用 所屬分類:
游戲-編程