1、從svn clone出項(xiàng)目,加上-s參數(shù)以標(biāo)記識(shí)別svn標(biāo)準(zhǔn)的目錄分支結(jié)構(gòu),同時(shí)通過show-ignore設(shè)置git庫的exclude屬性:
- git svn clone -s https://svn.xxx.com/svn/xxx
- git svn show-ignore >> .git/info/exclude
2、建立本地工作分支,開始工作:
- git checkout -b work
修改內(nèi)容直接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
結(jié)果svn rebase時(shí)在master分支上產(chǎn)生了一個(gè)新的node,這樣merge時(shí)就不能快速合并,出現(xiàn)了沖突,修復(fù)后,在dcommit時(shí)出錯(cuò),出現(xiàn)N個(gè)孤立節(jié)點(diǎn)。因?yàn)椴皇煜ぃ蚦heckout出work分支,進(jìn)行了dcommit,然后重新生成一次git庫。
今天解決了這個(gè)問題,參考以下網(wǎng)址:https://wiki.bnl.gov/dayabay/index.php?title=Synchronizing_Repositories。
以下重新描述一下問題和解決方法:
1、在執(zhí)行g(shù)it svn dcommit時(shí),出現(xiàn)如下錯(cuò)誤:
Committing to https://svn.xxx.com/svn/projects/trunk ...
提交時(shí)發(fā)生合并沖突: 您的文件或目錄”test/functional/xxx_controller_test.rb“可能已經(jīng)過時(shí): 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、這時(shí),重新執(zhí)行以下步驟即可:
- git svn fetch
- git svn rebase
- git svn dcommit
但我在執(zhí)行g(shù)it svn rebase時(shí),又出現(xiàn)沖突,這個(gè)時(shí)候,只需要手工合并掉沖突,并重新add一下:
- git add .
然后,再執(zhí)行:
- git rebase --continue
如果報(bào)告說沒有修改內(nèi)容,則換成執(zhí)行:
- git rebase --skip
完成rebase過程,這時(shí)就可以git svn dcommit了。
這樣,總算解決了svn歷史沖突問題,不用象前面那樣笨笨的重新git-svn clone.
posted on 2009-12-18 13:14
大日如來 閱讀(5733)
評(píng)論(1) 編輯 收藏 引用 所屬分類:
游戲-編程