» Sunday, 11 January A.D. 2009

using git

Time was that I was moderately anti-git; I felt that mercurial had more-or-less all the features and a nicer interface, so why weren't people using that?

However, I recently needed to use git to manage a patch series comprised of 40+ patches for contribution to an upstream project for work. I found it, on the whole, rather pleasant to use, especially when paired with magit. Committing individual hunks of patches and even individual lines of hunks is very handy for splitting things up into logical pieces. And of course git rebase --interactive is quite useful. I had to rewrite virtually ever patch in the series and make small tweaks on top of that big rewrite; I think I would have gone insane if I had used anything else. (I'm sure there was a way to do it with mercurial, but git was virtually required for upstream contribution.)

My biggest gripe with it so far are that --help invokes man. Besides being a dumb design--if I wanted to read the manpage, I know where to find it--I use shells in emacs for virtually everything nowadays, and invoking man inside such a shell results in unreadable output. (I use emacs's shell-mode; please don't suggest using ansi-term until at least the show-stopping bugs associated with long lines in ansi-term have been addressed.) Yes, I have attempted to tell git that I don't have a pager--or to change the pager on less capable platforms, like some of the Solaris machines at work that lack a GNU userland--but that doesn't seem to work. I find myself resorting to looking up the online documentation for simple things like command-line options or usage summaries, which is just stupid. At least make --help act like every other command-line program on the planet and provide --man or similar for the current behavior.

A distant second gripe is that it's not especially scriptable: git rebase, for instance, doesn't return different status codes based on whether you've elected to edit a commit, success in rebasing, or merge errors. (One can imagine making a set of scriptable changes to each patch--like I did--such that the rebasing process could be easily scripted. I suppose you could do it by parsing the output, but that's not particularly elegant.)

Magit is also not as nice as VC for some things: the common case of committing all changes takes a bit longer with magit and you don't get niceties like modeline indicators of what branch you're on.

Regardless, I am enamored enough with git to be using it on a skunkworks project for work.

posted by Nate @ 7:57PM