SaltyCrane Blog — Notes on JavaScript and web development

Colorized, interactive "git blame" in Emacs: vc-annotate

A few months ago, I learned that vc-annotate displays a nicely colorized git blame in Emacs. Today I learned that it is also interactive. I can cycle through revisions using p and n, open the file at a specified revision with f, view the log with l, and show a diff with d or changeset diff with D. (Unfortunately, the diff is ugly and not in color.)

vc-annotate is included with Emacs. To use, open a version controlled file, and type C-x v g or M-x vc-annotate

I am using Emacs 23.1 on Ubuntu Maverick

Comments


#1 Harsh commented on :

I gotta start using Emacs. This is nice!


#2 Huseyin Yilmaz commented on :

I find version control support of emacs hard to use. So, I prefer command line interface all the time. But I really could use that one. Specially browsing the history with p and n is awesome.


#3 calimocho commented on :

This makes me fall in love with emacs all over again.

Great tip!


#4 adam commented on :

@Huseyin

If you use git then try magit. Magit is by far my favorite thing in emacs (which there are alot of things to like).

Magit changed the way I develop.


#5 Ben commented on :

Another +1 for magit. It's the business.


#6 David Röthlisberger commented on :

The best command in vc-annotate is "a": Reruns annotate from the revision _prior_ to the revision that last changed the current line, so you can dig deeper into that line's raison d'etre, skipping uninteresting commits like whitespace changes.

See how to learn emacs for a more detailed coverage of vc-annotate and other emacs goodness.