使用git-svn在svn中轻松合并 [英] Easy merging in svn using git-svn
问题描述
在工作中,我们在SVN中使用了很多分支,并且在合并时出现了问题。我听说一个好主意是使用git更好地与git-svn合并。我尝试使用msysgit来玩它,但它并不像看起来那么容易。
我知道我可以使用 git svn来检出整个项目克隆-s
,但它看不到分支(正常的git分支)。我发现git-svn很难与git或svn比较。
你可以逐步描述如何进行这种合并吗?
$ b $ git-svn会为你提供SVN中每个分支和标记的分支(除非你使用问题/ 572893 /克隆 - 非标准 - svn-repository-with-git-svn / 572898#572898>>像svn2git这样的ruby脚本)这个想法始终是 git-svn rebase
/ git-svn dcommit
一个SVN分支。
即,你将同步一个SVN分支( git-svn rebase
),并且你将在相应的Git中更新一个SVN分支。分支( git-svn dcommit
)。
任何本地Git分支, em> local (即所有那些在Git中的分支/合并在SVN回购中都没有任何等价物)
作为 git-svn
去(见SO q uestion git-svn merge 2 svn branches ):
为简单起见,并与一个功能较弱的系统(SVN)进行互操作,建议所有
git svn
用户
克隆
,fetch
和dcommit
直接从SVN服务器,并避免所有git克隆
/拉
/merge
/push
git存储库和分支之间的操作。
在git分支和用户之间交换代码的推荐方法是git format-patch
和git am
,或者只是'dcommit
' SVN仓库。
运行
git merge
或git pull
不建议在你打算从dcommit
从>的分支上使用。Subversion不能以任何合理或有用的方式表示合并。因此使用Subversion的用户无法看到您所做的任何合并。而且,如果你从SVN分支镜像的git分支合并或拉出,dcommit
可能会提交给错误的分支。
At work we are using a lot of branches in SVN and there are problems in merging. I heard that a good idea is to use git better merging with git-svn. I try to play with it using msysgit, however its not as easy as it seems.
I know I can checkout the whole project using git svn clone -s
, however it does not see branches(as normal git branches). I find git-svn very hard to use compare to git or svn.
Could you describe in steps how to do that kind of merging?
git-svn will gives you a branches for each branches and tag in SVN (unless you use a ruby script like svn2git)
The idea is to always git-svn rebase
/ git-svn dcommit
a SVN branch.
ie, you will synchronize a Git branch with a SVN one (git-svn rebase
), and you will update an SVN branch from the new commits in the corresponding Git branch (git-svn dcommit
).
Any local Git branches, with all their fancy merges, must be local (i.e. all those branches/merges in Git won't have any equivalent in the SVN repo)
As the caveat in the git-svn
goes (see the SO question "git-svn merge 2 svn branches"):
For the sake of simplicity and interoperating with a less-capable system (SVN), it is recommended that all
git svn
usersclone
,fetch
anddcommit
directly from the SVN server, and avoid all gitclone
/pull
/merge
/push
operations between git repositories and branches.
The recommended method of exchanging code between git branches and users isgit format-patch
andgit am
, or just 'dcommit
'ing to the SVN repository.Running
git merge
orgit pull
is NOT recommended on a branch you plan todcommit
from.
Subversion does not represent merges in any reasonable or useful fashion; so users using Subversion cannot see any merges you've made. Furthermore, if you merge or pull from a git branch that is a mirror of an SVN branch,dcommit
may commit to the wrong branch.
这篇关于使用git-svn在svn中轻松合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!