February 16, 2008

Posted by John

Tagged peepcode, sinatra, svn, and twitter

Older: Merb and Capistrano

Newer: Handy iTerm Shortcut

Git and GitHub

I held out as long as I could, but on Wednesday, I grabbed a ham sandwich, nestled into my office chair and hit play in Quicktime for a lunch filled with my three favorite G’s—Geoffrey Grosenbach and Git. An hour later, I was kind of blown away and feeling stupid for not checking it out sooner. I cashed in my GitHub invite and started gitifyin’ some of my svn projects.

Why?

First off, it’s clean. You know all those .svn folders inside every directory of your subversion project? Well, you can have one .gitignore file in the root of your project and you are good to go.

Second, you can use it offline. Ever been away from a net connection? Yeah, me neither. But if it did every happen, wouldn’t offline mode be handy? Git is made for distributed development. This means you can do it all locally but it doesn’t hold you to just that. If you want (and who wouldn’t), you can setup remote git repositories which allows you to push and pull your project and share easily amongst a team or open source community.

Third, straight from the git website, Git has “strong support for non-linear development.” You know that branch feature of svn that you never use because you can’t remember the command? Well, git makes it gosh darn easy. Did I mention I taught my cat Bob to do it? Just be sure to give your animals a treat after they make a branch for you. You can create a new branch…do some crazy experimental thing…and only merge your crazy code into your master branch once you have it all working and fully tested (like a good little programmer).

Fourth, sweet svn integration. Yep, anytime you make a new tool, you have to give your new cult following some way to import all the crap they have in their current tool. I liked git for the first three reasons but I love git for this fourth. cd into your local svn project, use drnic’s gitify and you have a git repo that can also commit to your svn repo (for all of those still kickin’ it old school). Branch it up, make changes and when you are done git committing, just git svn dcommit and it transfers all your git commits to the remote svn repository. But what if someone updates the svn repo while you are gittin’ your git on? Well, Linus thought of that too. You can run git svn rebase and your git repo will update with the remote changes in your svn repo. This dude even has some sake tasks to make it easier to fool your svn friends into thinking that you aren’t using git.

How can I get started?

I would highly recommend breaking the bank for the $9 git screen cast by Geoff. He covers all the stuff you need to git going, including installation. Also, there are a few places where you can host your git projects for free (repo.or.cz, gitorious, and github, which I recommend). Pretty cool stuff. All I’m trying to get at in this article is if you are thinking, “Learn something new? But I already know subversion and it works for me…” stop thinking that, buy the peepcode and enjoy version control again.

How am I using it?

I’m now managing most of my gems on GitHub and loving it. After Jesse Newland whipped together a github-campfire post-commit, I copied him and took the credit, making a github-twitter post-commit soon after. On the topic, that was my first use of Sinatra and I definitely like it for little things like this.

GitHub Screenshot

Some Git Links

7 Comments

  1. Hi

    Thanks for this post. Just one thing link on “started gitifyin’ s” is bad as it’s still a local link :)

  2. I think it’s pretty obvious that svn has jumped the shark for a lot of people.

    Out of interest, why did you choose git over Mercurial? I found hg to be a lot closer command-wise to svn and cvs than git-*.

    Did you just find git first?

  3. @seb – thanks. fixed.

    @Dick Davies – Call me shallow but git is a way cooler name than mercurial. :) I’ve heard of mercurial but not enough people in my circle are using it for me to be interested.

  4. Great review John. You’ve made a great argument for moving from the aging Bushido of SVN to the sneaky Ninjutsu that is Git.

    I love (LOVE!) your Sinatra git-twitter app. It’s helpful to see more of these things in the wild.

  5. @Jack Danger Canty – No problem. Glad you like github-twitter. You can thank Jesse Newland who did all the hard work on the github-campfire script. I just copied his and adjusted to use my twitter gem.

  6. @john: I dunno; I love git but think that Mercurial has a way cooler name when you think about how the elemental properties of quicksilver compare to the way DSCMs handle branches.

  7. So John,

    The real question is. OMG DO YOU HAVE ANY INVITES?!?!?! :D

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a programmer who has fallen deeply in love with Ruby. Learn More.

Projects

Flipper
Release your software more often with fewer problems.
Flip your features.