我现在正在使用以下工作流程的git-svn:
git clone <SVN TRUNK URL> #done once
随后当我在开发一个功能时
git branch featureZ
git checkout featureZ
#make edits for featureZ
git commit
git checkout master
git svn rebase # fetch changes from server
git checkout featureZ #go back to branch
#git merge master
git rebase master #get the changes from SVN->master onto the branch now. Optional if I want the branch to be current. (EDITED: Got from the answer given below)
#make edits for featureZ
git commit #featureZ completed
git checkout master
git merge featureZ #getting featureZ onto master. Prepare to send to SVN
git svn dcommit #push featureZ back to SVN
现在需要注意的是,当我将feature分支与master合并时,所有单独的提交都会被合并为一个,这对我来说很好。
提交信息会替换为“merged with featureZ”。可以使用merge fmt msg进行修复。
现在我的问题是:在这个工作流程中有什么可能出错或需要注意的地方吗?我在git-svn手册中读到,当使用git svn时不应该进行合并。我正在做的工作流程是他们所指的吗?如果是,会导致什么问题?其中一件事是我不想做任何影响SVN主干的事情。
git checkout -b
命令来代替git branch ..; git checkout
。此外,使用co
作为checkout
命令的别名也是很常见的。 - jfs