簡體   English   中英

使用Git分叉SVN項目的最佳方法

[英]Best way to fork SVN project with Git

我使用Git分叉了一個SVN項目,因為我需要添加他們不想要的功能。 但與此同時,我希望能夠繼續將他們添加到上游版本的功能或修復功能下載到我的分支中(它們不會發生沖突)。 所以,我有我的Git項目與以下分支:

  • master - 我實際構建和部署的分支
  • feature _ *** - 功能分支,我工作或處理新事物,然后在完成時合並為主
  • vendor-svn - 我的本地唯一的git-svn分支,它允許我從他們的svn repo“git svn rebase”
  • 供應商 - 我將vendor-svn合並到的本地分支機構。 然后我推動這個(供應商)分支到公共git repo(github)

所以,我的流程是這樣的:

git checkout vendor-svn
git svn rebase
git checkout vendor
git merge vendor-svn
git push origin vendor

現在,問題出現在這里:我需要檢查他們所做的每個提交(最好是單獨的,因為此時我在他們后面約有二十個提交) 然后再將它們合並到master中。 我知道我可以運行git checkout master; git merge vendor ,但是這會引入所有更改並提交它們,而我無法看到它們是否與我需要的內容沖突。

那么,最好的方法是什么? Git似乎是處理項目分支的一個很好的工具,因為你可以從多個回購中提取和推送 - 我只是沒有足夠的經驗知道這樣做的最佳方法。

這是我正在談論的原始SVN項目: https//appkonference.svn.sourceforge.net/svnroot/appkonference

我的分叉是在github.com/jthomerson/AsteriskAudioKonf

看起來你應該只為master進行測試創建一個分支:

git checkout -b testing master
git merge vendor-svn
# test...
git checkout master
git merge testing

或者,如果要測試單個提交,可以一次單獨合並它們:

git checkout -b testing master
git log --pretty=%H testing..version-svn | while read commit; do git merge $commit || break; done
# now go check out and test each merge that was created

或者一次一個:

git checkout -b testing master
git merge $(git log --pretty=%H testing..version-svn | tail -n 1)
# now test the result, and if you're okay...
# run the merge command again to merge the next commit
git merge $(git log --pretty=%H testing..version-svn | tail -n 1)
# and so on

你可能會更喜歡后者,因為你可以先測試一下這個提交,然后再合並下一個提交。 歷史將是丑陋的,所以你顯然想要回去並重新將其重新整合為一個合並。

無論哪種方式都可以確定並將rerere.enabled設置為true,以便git將記住您如何解決沖突,當您返回並重新合並直接進入master時,您將不必再次解決它們!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM