0

Possible Duplicate:
Why is Git better than Subversion?

I follow a number of different open source projects, mainly around Java technology, but this question is probably universal. I have noticed over the last 6 months or so that many projects are moving Way from subversion and moving to git.

My question is why? What are the advantages of git over subversion, and do these advantages lend themselves to a commercial world (I.e should i be looking to replace my cvs and svn repositories with git)?

Community
  • 1
  • 1
Codemwnci
  • 54,176
  • 10
  • 96
  • 129

6 Answers6

4

C'mon, have you checked out WHO wrote git? Linus Torvalds himself!

Now seriously, I think there are mainly 3 great reasons to use git:

1) the cloning model: Using Subversion, you perform a "checkout", which is, in fact, just a snapshot of the repository in a given moment in time. Every other action (commit, branch, check logs, compare with previous versions) required network access to the original repository. Using git you effectively "clone" the entire repository to your local machine, allowing you to perform a series of local commits, rollbacks, browse the history, etc, without pooling the server again. This is a great thing for most open-source developers.

2) the forking model: In the days of Subversion, creating a fork of a project was such a catastrophic event. It usually meant that, in a few months, one of the projects would die. With git (and Github helps a lot on that matter), forks are easy and healthy, developers can merge changes in both ways, and many forks of a given projects can coexist.

3) partial commits: not many people use this, but you can choose to commit only part of a changed file (using git add -p). It saves a lot of time on delicate situations.

Of course there are a lot of other reasons why git (or DVCS in general) are way better than Subversion, but, for me, those 3 are the killers.

Fábio Batista
  • 25,002
  • 3
  • 56
  • 68
2

Hi please don't miss difference between github and git.

Github is only freely available git server.

And why github ? - Because you can easily fork and merge projects, only by clicking mouse.

This gives business value for me as: - anybody can do some work with my project and ask me to merge his changes, no special knowledge required, history of request easily visible... - watch changes on projects by using one account for all of them - you can also have closed repositories not publicly available (with some fees). - and probably a lot more, just visit github

What git itself gives please see responses of others.

mpapis
  • 52,729
  • 14
  • 121
  • 158
1

Because many programmers think that a distributed source control management system (such as GIT) is superior to one that required a centralized server.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • It's not so much about being decentralized, it's the power and abilities that come with being decentralized. You can rewrite history if you realized you made a mistake (before you commit), you can branch and merge locally without a remote server having to know anything about it, etc. – cdhowie Nov 12 '10 at 21:33
1

There are several reasons

  • Git, as a distributed system, is perceived as better.

  • You don't need read/write permissions and the administration hassle in a git-world.

  • It is easier to contribute to the project.

  • Git ultimately gives you more control of what is in the main repository and what is not.

Most of the cool advantages carries over to a commercial world I think. But start slow if you want to make the shift.

I GIVE CRAP ANSWERS
  • 18,739
  • 3
  • 42
  • 47
1

Frankly, I have no clue. I find git to have an obscure command syntax, and be generally really annoying and difficult to use. git is fast, but there are other DVCSes out there that are just as fast. I think overall there are better DVCSs than git that I think make a lot more sense to be using.

Now, why people are moving from Subversion to a DVCS is an obvious and easy question. Distributed version control systems are simply better in every respect.

In Subversion, I cannot check things out, make my own local changes and check them in. I have to have go through contortions like copying things into a vendor branch periodically and merging or some other ridiculous thing.

This has a whole host of positive benefits. The barrier to becoming a contributor becomes much lower. The project becomes easier to usefully fork. Tracking changes that the maintainer of a project doesn't want, but you do becomes much easier.

Additionally, when you check the project out on your laptop, your USB stick and your system at work there is now a clear and logical way to allow checking in all of those places regardless of internet connectivity and being able to join everything back up again later.

It also makes for an excellent distributed backup of the entire source repository and all of its history. It's nearly impossible for a DVCS repository to lose significant history since there are so many copies of it in existence.

Some people think the 'central control' of Subversion is a good thing. But really, you don't have any kind of control at all. All you're doing is making things really inconvenient for anybody who's not in the hallowed group of people you decide are committers. All those people can make their own copies of the source code and even the entire history. I routinely pull the whole Subversion history of a project into a DVCS in order to work on it.

A project using a DVCS has an authoritative repository that is every bit as authoritative as a 'centrally controlled' Subversion repository. The distributed model is a strict superset of the centralized model.

Omnifarious
  • 54,333
  • 19
  • 131
  • 194
1

It is because GIT makes branching and merging seamless. I have not heard any praise for SVN regarding branching and merging. GIT gives you total freedom over your own commits, and what you want to push to a common repository.

ivanpro
  • 13
  • 2