Git is definitely one of my favorite things but I already wrote about it, so I decided to write about some of the git add-ons that make my life easier. They are: gitosis, gitX, gitweb, and {OpenGrok.
gitosis (and gitolite)
One of the biggest problems I had to solve when we converted from Subversion to Git was, how do I handle access controls? At my current workplace, they’re fairly coarse-grained (web application vs. ops vs. platform core applications, for instance) but they do exist. We don’t currently do anything fancy within a repository (like restrict commits on a particular branch), so a pretty basic tool is fine. However, we also didn’t want to have to create a shell account for every user. Enter gitosis*. It’s a tool that manages ssh access to your repositories — you provide a configuration file that lists who is allowed access to which repositories, and ssh keys for the users, and it manipulates a single user’s authorized_keys file to provide access only to git commands using git-sh. Very simple.
Nowadays there’s a newer re-write of gitosis called gitolite that I would probably have used and may still move to. It has the following advantages: It’s still maintained; it has a nicer configuration file syntax; and it supports per-branch access controls, something gitosis doesn’t have. I haven’t switched to it simply because I have some scripts that already read and write the older gitosis.conf file format and we currently have no need for per-branch permissions — but if we ever do, I will switch to gitolite in a heartbeat.
gitX (and gitk)
gitX is a really nice Mac OS X gui for viewing branches, etc. It’s basically a souped up OS X native version of gitk, which comes with git. I use it all the time to try to disentangle the chaotic webs of branches my developers sometimes weave. gitk is good, too, if you’re not on a Mac.
gitweb
This is part of the standard git distribution, and it’s a very, very handy way to view your git repositories, especially if you have a lot of them. (We have, um, 458 at last count…) There are some alternatives to gitweb available, but I find the standard one works just fine. It gives you a way to list all of your repositories and display their branches and tags; browse the files; and even download a tarball of the code. Very handy for historical excavations.
Which brings me to:
{OpenGrok
OpenGrok is not a git-specific tool — indeed, I have some serious problems with the way it supports git — but it’s the best tool I’ve found for indexing and searching code. The problem it has with git is that it doesn’t understand how git works — it needs a clone with a checked-out working copy to index, which means that you need a separate clone for each branch. Fortunately, most of our projects now develop on master, so this isn’t a huge issue for us, but it’s something that should be fixed — and if I get some spare time, I might try to fix it. Certainly it should be possible for it to index a bare repository, but it would have to, er, grok git directly.
What are your favorite git tools?
* I highly recommend Garry Dolley’s excellent tutorial on installing gitosis, by the way.