如果要与其他开发者协作,总有那么一天你推送完毕之后,其他人发现他们推送自己修改的时候(与你推送的内容)产生冲突。这些修改在你合并之前将一直被拒绝。在 git svn
里这种情况形似:
$ git svn dcommitCommitting to file:///tmp/test-svn/trunk ...Merge conflict during commit: Your file or directory 'README.txt' is probably \out-of-date: resource out of date; try updating at /Users/schacon/libexec/git-\
core/git-svn line 482
为了解决该问题,可以运行 git svn rebase
,它会拉取服务器上所有最新的改变,再次基础上衍合你的修改:
$ git svn rebase
M README.txt
r80 = ff829ab914e8775c7c025d741beb3d523ee30bc4 (trunk)First, rewinding head to replay your work on top of it...Applying: first user change
现在,你做出的修改都发生在服务器内容之后,所以可以顺利的运行 dcommit
:
$ git svn dc