之前的项目都是使用
SVN,今天在
git-
svn上工作时,出了一点问题,记录一下,以便将来查询。
使用过程:
1、从 svn clone出项目,加上-s参数以标记识别 svn标准的目录分支结构,同时通过show-ignore设置 git库的exclude属性:
2、建立本地工作分支,开始工作:
修改内容直接commit,加上-a开头以省略 git add操作:
3、提交回 svn的过程:
在今天工作中,我提交回 svn的方式是:
结果 svn rebase时在master分支上产生了一个新的node,这样merge时就不能快速合并,出现了冲突,修复后,在dcommit时出错,出现N个孤立节点。因为不熟悉,就checkout出work分支,进行了dcommit,然后重新生成一次 git库。
(7/14更新)
今天解决了这个问题,参考以下网址: 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 rebase时,又出现冲突,这个时候,只需要手工合并掉冲突,并重新add一下:
然后,再执行:
如果报告说没有修改内容,则换成执行:
完成rebase过程,这时就可以 git svn dcommit了。
这样,总算解决了 svn历史冲突问题,不用象前面那样笨笨的重新 git- svn clone.
使用过程:
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
git svn clone -s https://svn.xxx.com/svn/xxx
git svn show-ignore >> .git/info/exclude
2、建立本地工作分支,开始工作:
- git checkout -b work
git checkout -b work
修改内容直接commit,加上-a开头以省略 git add操作:
- git commit -a
git commit -a
3、提交回 svn的过程:
- git checkout master
- git merge work
- git svn rebase
- git svn dcommit
git checkout master
git merge work
git svn rebase
git svn dcommit
在今天工作中,我提交回 svn的方式是:
- git checkout master
- git svn rebase
- git merge work
git checkout master
git svn rebase
git merge work
结果 svn rebase时在master分支上产生了一个新的node,这样merge时就不能快速合并,出现了冲突,修复后,在dcommit时出错,出现N个孤立节点。因为不熟悉,就checkout出work分支,进行了dcommit,然后重新生成一次 git库。
(7/14更新)
今天解决了这个问题,参考以下网址: 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 fetch
git svn rebase
git svn dcommit
但我在执行 git svn rebase时,又出现冲突,这个时候,只需要手工合并掉冲突,并重新add一下:
- git add .
git add .
然后,再执行:
- git rebase --continue
git rebase --continue
如果报告说没有修改内容,则换成执行:
- git rebase --skip
git rebase --skip
完成rebase过程,这时就可以 git svn dcommit了。
这样,总算解决了 svn历史冲突问题,不用象前面那样笨笨的重新 git- svn clone.