SVN Vs Git
Now that we know why we should use a VCS (Version Control System). We need to choose what kind of a VCS we want. There are a lot of VCS systems out there. How to choose one from all the variety there is out there? I will not say which one is the best, probably because there is’nt one “best”. It’s all depends on your requirements. I have experience in SVN (Subversion) and Git and not in every VCS there is out there, so I’m going to compare just these two. They are also currently the most popular ones.
Let’s start with the conclusion – In my opinion Git is better than SVN. I also talked about it with other people from the industry and they all concluded that Git is better, some of them still use SVN but that is only because it is a huge deal for them to perform the migration from SVN to Git.
(UPDATE from 2017: I do not know anyone that is using SVN anymore, probably there are still use cases. I just don’t know anyone who uses it)
Let’s go into the Why’s:
Locale Repository
The repository, the system that hold all the changes that were made to the files, in Git it is not only on the main repository on a remote server it is also in my local copy – that mean that if from some reason my server is gone – anyone that fetched data from the server – has a copy of the entire repository, on the branches that he fetched. that is a great backup repository strategy, all you need for that is to be updated.
Locale Commit
This is a huge advantage! It’s not only for the times that you are on a train without internet connection. When you work on a project you code almost everyday. sometimes there is an internet glitch and you will be stuck without a connection – if you are using SVN, you can’t commit so you will have to choose between two options :
- stop working until the connection is back
- keep on working but then you need to make the commit of a bigger changes, that mean that “task separated commits” can go wrong this way.
In Git – you can just do a local commit and then push all the commits at once. It is a good solution for when the repository is from some reason not accessible.
Built to Branch
In Git branching is easy and naturalץ Create a branch in no time with a single command. It is encouraged to branch before starting to work on anything. By branching (which is also possible on SVN, just less convenient…) You save yourself the problem of juggling between unfinished tasks, starting a more urgent one without the half baked work and when finished going back to the half baked and resuming the work. with the option to also include the last more urgent task! How great is that? Merging branches is as easy as creating branches and once starting using branches in Git I feel the peace of mind of not screwing someone elses work.
As I have said in the beginning – I’m pro-Git. I really like it and have very happy experience with it. It’s not that SVN sucks, I just think that Git is a lot more to offer.