SVN 和 Git 合并的区别是什么? [英] What's the difference between SVN and Git for merging?

查看:25
本文介绍了SVN 和 Git 合并的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所暗示的,我很好奇为什么这么多人吹捧 Git 作为分支/合并优于 SVN 的替代方案.我主要是好奇,因为 SVN 合并很糟糕,我想要一个替代解决方案.

Git 如何更好地处理合并?它是如何工作的?

例如,在 SVN 中,如果我有以下行:

世界你好!

然后 user1 将其更改为:

你好世界!1

然后 user2 将其更改为:

你好世界!12

然后 user2 提交,然后 user1 提交,SVN 会给你一个冲突.Git 能解决这么简单的问题吗?

解决方案

即在有冲突时调用合并,并且没有 ,Git 将比 SVN 更优雅地处理:
有关具体示例,请参阅合并 Git 与 SVN.

As the title suggests, I am curious as to why so many people tout Git as a superior alternative to branching/merging over SVN. I am primarily curious because SVN merging sucks and I would like an alternative solution.

How does Git handle merging better? How does it work?

For example, in SVN, if I have the following line:

Hello World!

Then user1 changes it to:

Hello World!1

then user2 changes it to:

Hello World!12

Then user2 commits, then user1 commits, SVN would give you a conflict. Can Git resolve something simple as this?

解决方案

That is called on merge with conflict, and no VCS will ever solve that for you.
You will have to manually solve the merge yourself.

As mentioned in Why merging in git is better than SVN, the actual difference is in the history recording of commits:

That allows Git to remember what has already merged, reducing considerably the conflicts occurrences.

So, when it comes time to do merge from 5b over to the (a) branch, we can use information in the DAG to know that 3b and 2b are already done


So it is the merge workflow that Git will handle much more gracefully than SVN:
See Merge Git vs. SVN for concrete examples.

这篇关于SVN 和 Git 合并的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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