简体   繁体   English

哪种版本控制工具最适合处理反射或循环合并? SVN,Git?

[英]Which version control tool is best suited to handle reflective or cyclic merging? SVN, Git?

Reflective/Cyclic Merging 反射/循环合并

This is easiest to explain with an example. 用示例最容易解释。 Suppose you are working on a feature branch copied from your trunk. 假设您正在处理从主干复制的功能分支。 During the development process you regularly merge ''all'' new changes from trunk to your branch so that the branch stays in "synch" with the work occurring on trunk. 在开发过程中,您定期将“所有”新更改从主干合并到分支,以使分支与主干上发生的工作保持“同步”。 When you eventually merge your branch back to trunk, that is called a reflective (or cyclic) merge. 当您最终将分支合并回主干时,这称为反射(或循环)合并。

Refer to Subversion merge reintegrate article on http://blogs.open.collab.net/svn/2008/07/subversion-merg.html for more details. 有关更多详细信息,请参阅http://blogs.open.collab.net/svn/2008/07/subversion-merg.html上的Subversion合并重新集成文章。 You can also refer to http://jugalps.wordpress.com/2009/07/31/svn-branching-and-merging-in-scrum/ to get an overview of a typical reflective merge process. 您也可以参考http://jugalps.wordpress.com/2009/07/31/svn-branching-and-merging-in-scrum/以获得典型反射合并过程的概述。 My personal experience with SVN is not good enough when dealing with such kind of scenarios. 在处理此类情况时,我对SVN的个人经验还不够好。

Does any one have experience working with any other version control tool apart from SVN for reflective merging? 除了SVN之外,是否有人有使用其他版本控制工具进行反射合并的经验?

Git has always been designed with this ability in mind. 始终在设计Git时就考虑了这种能力。 It was my first VCS, and to me, this type of workflow is totally routine. 这是我的第一个VCS,对我来说,这种工作流程完全是例行的。 In general, the merge (a push or requested pull) back to origin ("trunk") is trivial, since by regularly merging from origin, you have ensured that your HEAD (branch tip) has origin's HEAD in its past, so when origin merges your work, it merely has to move forward through the history, rather than actually perform a merge (git calls this a "fast forward"). 通常,合并(推或请求拉)回原点(“ trunk”)是微不足道的,因为通过定期从原点进行合并,您可以确保HEAD(分支尖端)过去拥有原点的HEAD,因此在原点时合并您的工作,它只需要向前浏览历史记录,而不是实际执行合并(git称其为“快速前进”)。

Git's rebase capability can also be used to make the history even prettier. Git的变基功能还可以使历史更漂亮。 If you adopt this workflow, you can always rebase your work on top of whatever you pull from origin, rather than merging them. 如果采用此工作流程,则始终可以将工作重心放在从源头获取的一切之上,而不是合并它们。 (This is rewriting history so you have to be sure not to do it with anything already published) That way, all of your merges from origin are fast forwards, and your work is just a single sequence of commits on top of origin's HEAD. (这是重写历史记录,因此您必须确保不要对已经发布的任何内容进行处理。)这样,您从原点开始的所有合并都是快速前进的过程,并且您的工作只是在原点的HEAD之上的单个提交序列。 This makes the history more direct - hopefully a straight line, instead of a series of lots of merges. 这使历史更加直接-希望是一条直线,而不是一系列的合并。

I recently switched all my new projects from SVN to git. 我最近将所有新项目从SVN切换到了git。 All I can say is Branching and Merging is MUCH easier. 我只能说分支和合并要容易得多。

Branches are so easy to create and manage that practically every day's development gets a new branch, where I commit to my local branch, then merge back when I'm done. 分支是如此易于创建和管理,以至于几乎每天的开发都会获得一个新分支,我将其提交到本地分支,然后在完成后合并回去。 I'm working with a small group, and we've had no trouble working like this. 我正在与一个小组一起工作,我们像这样工作毫无困难。

As you said reflective merging with SVN used to be a nightmare, but with latest version of svn 1.6.x series, there is much support for it (now merges save meta-data related to the merge in the history, that helps when merging back changes). 正如您所说的,与SVN进行反射合并曾经是一个噩梦,但是对于最新版本的svn 1.6.x系列,它提供了很多支持(现在,合并保存了历史中与合并相关的元数据,这对合并时有所帮助变化)。

I currently use Bazaar as VC system (it is a distributed VCS, like Git), and i can say it has more support for branching and re-parenting/merging-back branches into main-line. 我目前使用Bazaar作为VC系统(它是一个分布式VCS,如Git),我可以说它对分支以及将主分支重新合并/合并回主行提供了更多支持。 Also Git has support for that (rebase), both are designed with branching/merging-back in mind. Git也支持该(重新设置),两者在设计时都考虑了分支/合并。

IBM Rational's ClearCase product has major support for exactly this mode of operation - it is a standard way of working on development branches, and the merging is pretty much automatic in both directions (unless there are conflicting changes, of course). IBM Rational的ClearCase产品完全支持这种操作模式-这是开发分支上的一种标准工​​作方式,并且合并几乎在两个方向上都是自动的(当然,除非有冲突的更改)。 However, the rest of the infrastructure needed for ClearCase probably means you will only use it if your company makes a major investment decision. 但是,ClearCase所需的其余基础结构可能意味着只有在公司做出重大投资决策后,您才可以使用它。

Subversion, being more or less a huge bugfix for CVS, has similar problems with merging as CVS. Subversion或多或少是CVS的一个重大错误修正,与CVS的合并存在类似的问题。 Both were designed for really simple merge cases, not what we use today (hundreds of people working on the same code base with each one having a slightly different version). 两者都是为真正简单的合并案例而设计的,而不是我们今天使用的合并案例(数百个人在相同的代码库上工作,而每个人的版本略有不同)。

Git and other modern DVCS were designed to solve this (plus the distributed VCS part). Git和其他现代DVCS旨在解决此问题(以及分布式VCS部分)。 Git comes with a lot of different merging algorithms and it's easy to create a new one. Git带有许多不同的合并算法,创建新算法很容易。 But my guess is that it would be hard to come up with a scenario that the Linux kernel developers haven't seen so far ;) 但是我的猜测是,要想出一个Linux内核开发人员到目前为止还没有见过的场景是很难的;)

From my personal experience, Git is a nice tool if you forget most that you know about SVN. 根据我的个人经验,如果您对SVN的了解最多,那么Git是一个不错的工具。 Otherwise, you'll try to apply your SVN/CVS knowledge and that just won't quite work. 否则,您将尝试应用您的SVN / CVS知识,但这根本行不通。 Sit down, work through the tutorials and really start working as if you have never seen a VCS before. 坐下来,通读教程,然后真正开始工作,就像以前从未见过VCS一样。 For example, I tried to put several projects into a single repository. 例如,我尝试将多个项目放入一个存储库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM