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

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

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! 😀

You made it all the way down here so you must have enjoyed this post! You may also like:

How to generate SSH keys for Git authorization Hrvoje Ivancic
, | 21

How to generate SSH keys for Git authorization

Version control systems in UI design Katarina Dijakovic
Katarina Dijakovic, | 3

Version control systems in UI design

How to setup GIT for Magento extension development Branko Ajzele
Branko Ajzele, | 10

How to setup GIT for Magento extension development

8 comments

  1. It seems every article, not just this one, boasts how Git allows developers to work offline, compare revisions, merge branches, view history, go back to an earlier version and much more. Which is good. Git may be a great tool. I have never used it, which is why I googled to find the pros and cons. However, everything listed as a pro for Git in all the articles I have read are also true in Subversion. True, you can’t physically commit a change to the central subversion repository if you are offline. But you can save changes to code in your sandbox offline and commit those once you are back online (although I don’t know why you would not just jump online and log in using a VPN). With Git, it sounds as if one is trying to merge branches or create a build for the test box or production, and a user is offline, code needed will not be pulled in from the offline part of the decentralized repository. With Subversion you can certainly view your history, compare between branches, etc… If you can provided true differences between the 2 it would be of help. I would like to have time to install and play around in Git. Unfortunately I do not have time to adequately review Git on my own. I have to decide on an SCM tool for our enterprise in a month’s time. Without a comparison that shows me why Git is better, I am leaning towards Subversion, as I know its strengths and weaknesses. But I did find the article useful. I know it is hard to wrap up a comparison in a nice, concise article. Thanks.

  2. 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!

  3. @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!

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

  5. “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

  6. 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 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.