Random thoughts on using Git

Published on 29 March 2011 by @mathiasverraes

A couple of weeks ago, I switched from Subversion to Git for a couple of smaller projects. Below are some of my findings.

Switching from Subversion

Git is a little harder to understand than Subversion, because of it’s lack of a centralized repository, and because it has more concepts you need to understand. But if you already understand SVN well, it’s very manageable. I’ve no idea how the learning curve compares to SVN for a complete newbie to version control.

If you are on the fence, there are two things that I wish I knew about sooner:

Open source community

GitHub alone is plenty of reason to switch to Git. It seems like the whole PHP community (and the whole open source community) are moving to GitHub. And you can’t blame them. GitHub works really, really well. It makes it easy to maintain your own fork of a project, make changes and send them as pull requests. Symfony2 for example noticed a huge increase in contributions since the move.

Even if you only consume open source code and don’t plan on contributing patches, you’ll find you need to understand at least how cloning and pulling work, so you can easily download code.

Svn:externals

I usually include third party libraries in my projects using svn:externals. At the moment, a lot of PHP libraries that switched to git, still sync to SVN. But I’m sure that people will stop bothering with that. That’s a problem if your SVN repository depends externals. You could set up your own syncing, or take the hint and move to git.

Fixing ‘oops’ moments

With SVN, commits are pretty much written in stone. Because of that, a convention has emerged:

Git has a lot more possibilities to fix errors, amend to commits, etc. That’s a blessing and a curse. I find that by trying to make my history look pretty, I seem to make a mess of things. It’s not a big deal, because in Git, nothing is ever lost. Perhaps it’s just my lack of experience with git. In any case, I think that for now, I will stick to the SVN convention and won’t try to hide my clumsiness from the world.

Follow @mathiasverraes on Twitter.



Upcoming

2018
Topic Event Type Location Date
Advanced Domain-Driven Design DDD Europe workshop Brussels, Paris 2018
Design Heuristics DDD eXchange keynote London April 2018
DDD for Messaging Architectures ExploreDDD workshop Denver Sep 2018
Design Heuristics Kandddinsky talk Berlin Oct 2018
Tactical DDD Kandddinsky workshop Berlin Oct 2018
Past agenda entries...

Blog

2016

2015

2014

2013

2012

2011

Creative Commons License This work by Mathias Verraes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.