如果仍然需要执行相同的步骤,那么git merge比svn merge更好吗? [英] How is git merge better than svn merge if you still have to go through the same steps?

查看:142
本文介绍了如果仍然需要执行相同的步骤,那么git merge比svn merge更好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读如何和/还是为什么在Git中进行合并比在SVN中进行合并更好? 我还是不明白.假设我要维护多个版本(我需要在生产环境中维护所有版本):

After reading How and/or why is merging in Git better than in SVN? I still don't get it. Let's say I have multiple versions I'm maintaining (I need to maintain them all, all in production):

  • v1.0
  • v1.1
  • v1.2
  • v1.3
  • v1.4

现在,我向v1.0提交了一个错误修正(并且在所有后续版本中都需要此错误修正).

Now I commit a bugfix to v1.0 (and I need this bug fix in all next versions).

现在在git和svn中,我已经可以执行以下逻辑操作

Now in both git and svn I have to perform the following logical operations

  1. x = 1
  2. 合并到下一个分支v1.(x)
  3. 检查v1一切正常(测试,构建).(x)
  4. x ++转到(2),直到最后一个分支

为此使用git(或gerrit)的主要好处是什么? 合并到下一个分支 commit test 的逻辑操作是相同的!那么有什么不同呢? (如果只是较小的合并算法改进,那么对我来说并没有太大关系.在Subversion中,我有一个相当不错的自动合并解决冲突.而且,我不介意签出分支v1.1在Subversion中进行合并,因为我有一些实用程序可以帮我做到这一点,所以我不花时间在上面.)

What is the major benefit of using git for that (or gerrit)? The logical operations of merge into next branch, commit, test are the same! So what is different? (If it's just minor merge algorithm improvements, it does not matter to me too much. I have a rather nice automatic merge resolve conflicts in Subversion. Also I don't mind checking out branch v1.1 to do the merge in subversion because I have some utility that does that for me so I invest no time in it).

推荐答案

由于git不像其他版本控制系统那样存储增量,因此它在每次提交中存储每个文件的全部内容(以一种非常压缩和有效的方式) ,但是为了简化起见,请记住它不存储增量,很抱歉重复一遍,但这就是为什么大多数刚接触git的专业人士都感到如此困惑).

Because git doesn't store deltas like other version control systems do, it stores the full content of each file in each commit (in a very compressed and efficient way, but to keep the things simple, just keep in mind that It doesn't store deltas, sorry to repeat but this is why most professionals new to git get so confused).

当必须合并时,请在每个分支的最后状态/快照与公共基本祖先之间进行三向合并,而不是尝试应用一个分支的最后100次提交的增量/差异(具有更改的上下文)进入另一个.

And when it has to merge, makes a three way merge between last state/snapshot of each branch and a common base ancestor instead of trying to apply the deltas/diffs (with changed contexts) of the last 100 commits of one branch into another.

更简单的方法,而且更有效,不会给用户带来100次冲突.

Way simpler approach, and it's way more effective, it doesn't leave the user with 100 conflicts.

这篇关于如果仍然需要执行相同的步骤,那么git merge比svn merge更好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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