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

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

问题描述

正如标题所暗示的,我很好奇为什么很多人都认为Git是SVN分支/合并的优越选择。我主要是好奇,因为SVN合并糟透了,我想要一个替代解决方案。



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



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



Hello World !

然后user1将它改为:



Hello World!1



然后user2将它改为:

Hello World!12

然后user2提交,然后user1提交,SVN会给你一个冲突。 Git可以解决这样简单的问题吗?

解决方案

这是在冲突合并时调用的,没有VCS会为您解决这个问题。
您必须自己手动解决合并。



正如 :

查看合并Git与SVN for具体的例子。


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 worflow that Git will handle much more gracefully than SVN:
See Merge Git vs. SVN for concrete examples.

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

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