Notes from a moron about Git

It took me two years, but galdarnit, I did it. I migrated a project over to Git and got to see what I've been missing this whole time. And it made me feel like a moron for waiting so long. If you're a late majority holdout like me, there's probably not much I can do to convince you to move over that hasn't been tried already. But when you get there, you can put me on the list of people that said "I told you so".

Alternately, if you're reading this because you were one of the people that told me so, and don't know about it already, you can help the Drupal Git migration team by teaching your fellow Drupalists in meetups and camps. I'm behind you all the way, though it will probably take a couple more years for me to start teaching it myself (late majority).

A lot has been written about the benefits of using Git, but there were some things I didn't run across until I started using it myself. Below is a little list to compare my Git experience with SVN:

  • Messages are way more helpful. Misspelled 'status' and it said 'Did you mean status?'. 'git status' gives you suggestions on what to do to add new files in and such.
  • Patch syntax makes more sense. "git apply" instead of "patch -p0"
  • Multi-line commit messages in a default text editor.
  • Colorful messages (I'm a sucker)
  • gitk command is really cool - Shows a graphical representation of commits over time, the interaction fo branches, nicely browsable.
  • Active IRC channel (600 people)
  • In a conflict, no files get created. There's just conflict messages in the file. You resolve and commit. SVN produces several files which can be confusing. Also don't need to mark resolved.
  • Commits contain real name and e-mail address, instead of just a username
  • Nicer progress reports when pushing - shows you percentage completed.
  • Much simpler to change remote repository hosting providers without losing data.

And here's a few resources I used to get started:

Enjoy!



Comments

Another thing to add to the list of cool things over SVN is that there's only a single .git file that stores history about everything. Instead of multiple .svn folders with subfiles that store information about current directory and files.

Nice article. Glad to see another Drupal Pro switching to GIT. I can't wait for the roll out on Drupal.org.

Hey Dave! I think this is pretty slick too, but there's a trade-off. It means that if you want to work with a sub-directory of Git instead of the full repo, it's not as straightforward. But, it's also a whole lot simpler, and doesn't exponentially multiply files when using stacked version control systems.

Git on d.o is going to be rad. :)

Chris,

If you're using Mac, check out GitX and the upcoming GitBox. These are lightyears ahead of GitK in terms of usability. For Linux there's Giggle which looks really good.

We (NodeOne) started off with Git, then used Bazaar for a while to try it out. It has tons of nice features that deal with managing branches and organizing your source code revisions in ways Git seemingly can't. Bazaar seems to be a lot slower than Git. That and Drupal's move to Git made us choose Git over Bazaar. Combined with repository hosting at GitHub, version control has become extremely reliable and easy.

Bazaar offers a lot of nice features for Scrum teams. I recommend checking out Rob Purdie's presentation from DrupalCon Copenhagen – The Definition of Done. Great examples of how Bazaar and Launchpad can be used to manage branches across several teams.

Cheers,

Jakob

Thanks for throwing in some info about Bazaar, I haven't had a chance to play with that at all. I'd like to hear more about the features you weren't able to find in Git. Also, thanks for the tips on GitX and GitBox, I'll definitely be checking those out. Cheers!

Yeah. I am also a git fanboy and one of my favorite thing about it is the distinction between the Author of a patch and the actual Committer; this is very important in a open source workflow, this way contributors (Authors) can be listed explicitly in the project history even if they don't have commit rights.

Taking credit for some sporadic contribution to drupal code is not that trivial right now with CVS :)

Regards,
Antonio

Another cross-platform gui worth checking out is SmartGit; free for non-commercial use.