I'm software developer and microISV, with a lot of passion to technologies.. having a fun writing code, writing blog posts and giving public speeches. For about 10 years of total experince I've been working in many branches of software development, including management and QA. I try to follow and adopt agile practices and signed up for software craftsmenship manifesto. Alexander is a DZone MVB and is not an employee of DZone and has posted 67 posts at DZone. You can read more from them at their website. View Full User Profile

Git with SVN, what the benefits are?

07.13.2011
| 5732 views |
  • submit to reddit

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

 

From http://www.beletsky.net/2011/07/git-with-svn-what-benefits-are.html

Published at DZone with permission of Alexander Beletsky, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Fab Mars replied on Sat, 2011/07/16 - 6:28pm

There was a similar post here on dzone not long ago.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.