Git with SVN, what the benefits are?
My previous post about start to use Git in an SVN organization appeared to be really attractive, I received many questions through Twitter and DZone. All of them are really interesting and I will do a separate post on that, but primary question is "Why, oh why?".
So, what actual benefits I see of using the git-svn approach?
First, let's see the root, what kind of VCS is Git ? It is a distributed one. The distribution basically means that each developer hosts the repository on his own machine. Not a working copy as in the case of SVN, but a real repository with all the corresponding functionality - commits, reverts, branches, merges etc. You are no longer dependent on the server, even if the server is not available you can still able to continue your job.
Since you have your local repository, you can do whatever you want without interfering with the rest of the world. In SVN all operations like commit or branch creation or tag - they are global operations. As soon as you have created branch for instance, everybody will notice that; if you committed something, everybody will notice that. In many organizations SVN has policies, like you have access only for some branches.. you can't create branches, only by request to admin etc. But, what I basically do in my job - I want to try out something (new idea or apply some refactoring) without disturbing a lot of people, I want that quickly. It perfectly works with Git, I create the branch just through one command, work inside (and do whatever number of commits I want) and if I think I'm ready, merge it back to master and push changes to SVN.
Remember your last merge operation with SVN? If you haven't seen 'Tree conflict' type of conflict, you are not SVN user. I've seen them a lot and many people suffer much of it! This type of conflict happens because SVN keepsa tracking information about the folder in which file is placed. Git does not do that, it is basically a content tracking system - Git cares about content of the file, not file it self. Since the information about the content (blob) and filesystem information (tree) is separate from each other, you will never get a 'Tree conflict' in Git.
The fact that branches and merges are very easy in Git you are getting one really cool bonus. Have you ever been in situation then in a middle of your flow, then ten files are already changed, but you still struggling with task, your boss is contacting you saying - 'Hey, we have critical bug, required to be fixed now'? Such things make you a little uncomfortable, you already got some changes, but they are not 'commitable'.. you could not throw it away, because some value is already there, but you need to get SVN update and start to fix bug. With git, you can switch from one task to another with out any problems. You just commit your results (even if they are not compliable or tests are red, who cares - it's yours repository) create another branch for bugfix and start to work.
To summarize that a little I would say that my personal benefits of starting using Git are:
- Isolation - do whatever I want, whenever I want
- Merges - forget about 'Tree conflicts'
- Task switching - no more, "please wait till I commit this, so I can start to work on that"
- Fun - it is interesting to me to learn new system and to change my mind about how VCS can work
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)