Random thoughts on using Git

By Mathias Verraes
Published on 29 March 2011

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.


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:

  • Faulty commits are followed by a commit labeled ‘reverted rev 123’
  • Incomplete commits are followed by a commit with the same message

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.