Tag Archives: git

An interactive, iterative ‘git blame’ mode for Emacs

I’m an active user of Magit for all my Git needs within Emacs. One thing I’ve always found missing was nice support for ‘git blame’ — and by ‘nice’ I mean some more comfort than the simple display of its output.

When I’m hunting bugs one thing I often need is not only the information who modified a certain line but also who modified the line before that. Also what I’d like is having both the source code (including syntax highlighting, of course) and the blame information shown side-by-side with quick access to the log message for particular commits.

That’s what ‘mo-git-blame’ tries to solve. It is a standalone mode that can be used with any of the various Git version control modes. Here are a couple of its features:

  • Shows the output of ‘git blame’ and the file content side-by-side with syntax highlighting for the content
  • Show the log messages for the current revision or the revision in the current line
  • Show the diff (via ‘git show’) for the current revision or the revision in the current line
  • Show the file content for the revision in the current line
  • Call ‘git blame’ for the same file for the revision in the current line

Here’s what it looks like:

Screenshot of Emacs with mo-git-blame-mode

Screenshot of Emacs with mo-git-blame-mode

You can download the sources from my Git repository or directly with

git clone git://github.com/mbunkus/mo-git-blame.git

Installation and usage instructions are included both in the file itself and its README, but here’s the short version:

(add-to-list 'load-path "~/.emacs.d/mo-git-blame")
(autoload 'mo-git-blame-file "mo-git-blame" nil t)
(autoload 'mo-git-blame-current "mo-git-blame" nil t)