Git vs SVN A.K.A. Everyone likes control

Featured Image

Hi! Today I’ll try to make an objective overview of both SVN’s and Git’s pros and cons from developer side. I won’t go into depth of configuration of any of them neither will discuss specific commands, but rather functionality itself.

I’d like to point out that the two most famous types of version control systems are:

  • Centralized version control system – subversion (SVN)
  • Distributed or decentralized version control system – Git

And that’s the big difference, others are just a small smaller things that are based upon this main fact. I won’t say that they don’t matter, au contraire, like French would say, amount of that small things is greater in volume than you’d think.

And now, enough with the “general stuff”, let’s put everything on a list.

SVN

SVN is a powerful version control tool and many companies have been using it for quite some time. Over the history, it became the most popular version control system in the world.

The “Pros”

  • SVN is well-known, wide-spread solution that makes everyone comfortable.
  • Its centralized repository makes tracking simpler
  • There are only two basic commands (used on daily basis):
  1. svn commit or svn ci. This command recursively sends your changes to the SVN server. It will commit changed files, added files, and deleted files.
  2. svn update or svn up. This command syncs your local sand box with the server. If you have made local changes, it will try and merge any changes on the server with your changes on your machine.
  • SVN help is more organized and to the point. Even a quick Google search will get you much more simple examples than for Git

The “Cons”

  • SVN stores a pristine copy of every checked-out source file on the client side, in a subdirectory of “.svn“.
  • Space requirement is much greater than with Git
  • Requires Internet connection for many “daily” stuff – which makes it much slower compared to Git

Git

The “Pros”

  • Stronger branching than any other Source Code Management
  • Faster than SVN (in this example) – mainly because it does common tasks like “diff” locally, which include
  1. Perform a diff.
  2. View file history.
  3. Commit changes.
  4. Merge branches.
  5. Obtain any other revision of a file (not just the prior committed revision).
  6. Switch branches.
  • Smaller complete “filesize” of repository

The “Cons”

  • Overkill on documentation (IMHO) – can’t easily find small examples
  • It can get difficult to track branches and revisions

The Conclusion

Although SVN is the popular choice, I’d go with Git any day. Not because I’m geeky (and Git would fit into that perfectly), but from the developer side. The fact is that when using version control system, you’ll mainly do a “push”, “pull” and “difference”. And If it has to be directly on server, it will get lagged sometimes (depending on the changes and connection). Git’s capability to create number of “commits” locally and putting it to server with one push is great. Combined together with “difference” locally its my choice of tool. Solely on those two facts.

On the other hand – you will hear that some clients require SVN, and you’ll almost never hear that kind of request for Git – that’s true. But you can always use SVN for specifics, and Git for your comfortability on other projects. And another relevant fact – when I looked into material for this article – I almost couldn’t find an article “SVN over Git” – it was the opposite way.

To “conclude the conclusion” – small example from “real life” I found on the Internet:

For example the Mozilla repository is reported to be almost 12 GiB when stored in SVN using the fsfs backend. Previously, the fsfs backend also required over 240,000 files in one directory to record all 240,000 commits made over the 10 year project history. This was fixed in SVN 1.5, where every 1000 revisions are placed in a separate directory. The exact same history is stored in Git by only two files totaling just over 420 MiB. SVN requires 30x the disk space to store the same history.

As this is exclusively my opinion, I’m very interested in yours. Please express yourselves!

Cheers! :D

7
Top

Care to rate this post?

Author

Mladen Lotar

Ex. Inchooer

Mladen worked at Inchoo from 2010 to 2011 in the role of Magento/Zend developer

Other posts from this author

Discussion 7 Comments

Add Comment
  1. I’ve been trying to find an article about Git vs. SVN from a Magento perspective for some time now. Thanks! A follow-up article on how to deploy Git for Magento development would be awesome ;)

  2. The best feature of git for me is the easy and cheap branches and merges.

    @Andrew This link is a very good resource, also adaptable for magento: http://nvie.com/posts/a-successful-git-branching-model/

  3. it is I

    “It can get difficult to track branches and revisions”

    I always thought that is THE MAIN PURPOSE of any version tracking software’s existence is to provide branches and revisions tracking. I mean, what are we talking about here?

    +1 for GIT

    -1 for article

  4. it is I

    err… +1 for svn too… I’ll go find some real software review before I say one of those is better…

  5. @it is I – generally I don’t react to things like this, but when you see 10 different branches merged by couple of users and react to that like: oh, now I know everything in 15 seconds. – I’ll give you my full respect.

    Until then, please don’t take things out of the contest. All I wanted to say is that Git’s branching is more complex than SVN’s.

    Cheers!

  6. @Mladen
    on how many Magento projects with SVN did you work on?

  7. Hi Vedran, I really haven’t besides I tried it. But to answer your question I ask you how many projects you completed on Linux? It’s not about the question could it be done, but how fast and about personal attitude about some peace of software.

    I argumented why I think that Git is better, and I don’t see your arguments…

    Cheers!

Add Your Comment

Please wrap all source codes with [code][/code] tags.
Top