Git browse: An interactive git blame tool

Posted on

Git's a great tool, but it's not always the most helpful. In particular, I often find myself needing to step back (or forward) through a particular file's history to find out why a certain line was introduced. git blame gets me part way there, but if the line I'm interested in has changed several times then I have to have to run blame several times, and each time I have to remember (or more likely copy and paste) a commit ID. Even when I've found the revision I was looking for, git blame is only going to tell me who wrote it and not why, so then I have to run git show to see the commit message and the wider context of the change.

After failing to find anything that solved my problem, and speaking to other developers who felt the same way, I decided to take matters into my own hands, and this is the result: git browse

git browse in action

Using it is simple: Just run git browse example.html and you'll see the current revision of example.html in a less-ish interface. Hit p and n to move to the previous or next revision, and when you've found the one you're looking for you can either quit (q) or quit and immediately run git show for that commit (s).

You'll find code and documentation over on GitHub: github.com/georgebrock/git-browse