MKVToolNix logo mosu's Matroska stuff

An interactive, iterative ‘git blame’ mode for Emacs

2009-10-23 — mosu

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](https://www.bunkus.org/wp-content/uploads/2009/10/mo-git-blame-mode-150x150.png "Screenshot of Emacs with mo-git-blame-mode")](https://www.bunkus.org/wp-content/uploads/2009/10/mo-git-blame-mode.png)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)
© 2002 – 2024 Moritz Bunkus   |   Imprint/Impressum   |   Data Protection/Datenschutz   |   Cookie settings