Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes Git better than Subversion for merging? [duplicate]

Possible Duplicate:
Merging: hg/git vs. svn

I've heard/read that Git and DVCS's in general are better than Subversion and centralized version control systems. And one of the reasons I've heard for this is that merging is so much better in DVCS's than in centralized system.

What is the difference between the two when it comes to merging? What makes Git better than Subversion when you're re-integrating a branch, for instance?

like image 668
Brandon Montgomery Avatar asked Nov 18 '10 13:11

Brandon Montgomery


People also ask

How is Git better than SVN?

Many people prefer Git for version control for a few reasons: It's faster to commit. Because you commit to the central repository more often in SVN, network traffic slows everyone down. Whereas with Git, you're working mostly on your local repository and only committing to the central repository every so often.

Which feature of Git makes it attractive over SVN?

Git has the advantage that it's MUCH better suited if some developers are not always connected to the master repository. Also, it's much faster than SVN. And from what I hear, branching and merging support is a lot better (which is to be expected, as these are the core reasons it was written).

What makes Git unique from other tools like SVN?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.


1 Answers

It's not so much the fact that they're distributed, but more that they keep track of changesets rather than versions. (However, distributed systems usually work with changesets, while centralized ones often use versions; this is because distributed systems just won't work with a version-based approach, while centralized systems can get away with it).

Subversion says, OK, first I had this version and then I had that version. And then when it's time to merge, it takes the two versions, compares them, and makes educated guesses on how to combine them. Git, mercurial, and similar SCMs, say, OK, first I had nothing, then someone made this change and then someone else made that change, etc. When it's merge time, basically all they need to do is apply the changes in the correct order, correcting for line numbers here and there and taking file renaming into account, but that's basically it.

Subversion doesn't really have enough information to perform an intelligent merge: it only sees the differences, but not where they come from.

like image 100
tdammers Avatar answered Sep 28 '22 01:09

tdammers