使用 git-svn 在 svn 中轻松合并 [英] Easy merging in svn using git-svn

查看:103
本文介绍了使用 git-svn 在 svn 中轻松合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

工作中我们在SVN中使用了很多分支,合并存在问题.我听说一个好主意是使用 git 更好地与 git-svn 合并.我尝试使用 msysgit 玩它,但它并不像看起来那么容易.

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.

我知道我可以使用 git svn clone -s 检查整个项目,但是它看不到分支(作为普通的 git 分支).与 git 或 svn 相比,我发现 git-svn 很难使用.

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 会为你在 SVN 中的每个分支和标签提供一个分支(除非你使用 像svn2git这样的ruby脚本)

git-svn will gives you a branches for each branches and tag in SVN (unless you use a ruby script like svn2git)

这个想法是总是 git-svn rebase/git-svn dcommit 一个 SVN 分支.
即,您将同步一个 Git 分支与一个 SVN 分支(git-svn rebase),并且您将从相应 Git 分支中的新提交更新一个 SVN 分支(git-svn dcommit).

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).

任何本地 Git 分支,以及它们所有花哨的合并,都必须本地(即 Git 中的所有这些分支/合并在 SVN 存储库中不会有任何等效项)

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)

正如 git-svn 中的警告一样(参见 SO 问题git-svn 合并 2 个 svn 分支"):

As the caveat in the git-svn goes (see the SO question "git-svn merge 2 svn branches"):

为了简单起见以及与能力较低的系统(SVN)互操作,建议所有git svn用户clonefetchdcommit 直接从 SVN 服务器,避免所有 git clone/pull/merge/push git 存储库和分支之间的操作.
在 git 分支和用户之间交换代码的推荐方法是 git format-patchgit am,或者只是 'dcommit'ing 到 SVN存储库.

For the sake of simplicity and interoperating with a less-capable system (SVN), it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches.
The recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit'ing to the SVN repository.

不建议在您计划 dcommit 的分支上运行 git mergegit pull.
Subversion 不代表以任何合理或有用的方式进行合并;所以使用 Subversion 的用户看不到您所做的任何合并.此外,如果您从作为 SVN 分支镜像的 git 分支合并或拉取,dcommit 可能会提交到错误的分支.

Running git merge or git pull is NOT recommended on a branch you plan to dcommit 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆