Use revision control annotation in your editor

I was discussing comments vs. intention-revealing code with some folks on Twitter today and I realize that there’s a tool I take so much for granted I don’t even think about it any more. The tool is called VC-Annotate in Emacs, but some form of it should exist in every decent editor.

If you’re a programmer and you’re not using your editor’s revision control annotation features, I strongly recommend learning about them ASAP. They are an essential tool in understanding the story behind the code.

httpv://youtube.com/watch?v=rjnm-suxfRI

15 comments

  1. Thanks for the tip Avdi – really powerful.

    Does anyone know of similar functionality in vim? Closest I could find was VCSCommand1 however I’m not sure it goes as far as Avdi does here.

      1. Yeah.. Tim Pope’s Fugitive does exactly that. Just type :Gblame in normal mode and you’ll see the exact thing what Avdi is showing here. You can open each commit shown in that view by pressing ‘o’.

  2. vc-annotate brings me one step closer to Emacs for everything. Thanks for sharing!

  3. Just came across this. Never realised how much under-used VC is in my workflows. I’ll have to see if this works with Perforce as well. Thanks for the tip.

    BTW, what’s the colour scheme you’re using in there ?

        1. There is actually very little overlap between the two. Magit is for managing a whole project under revision control. It’s what I use when I’m selecting files/hunks for a commit, for instance. Or pushing, pulling, rebasing—anything that takes effect project-wide.

          vc-mode, OTOH, is totally buffer/file-focused. It won’t show you the state of your whole project, but it will tell you quite a bit about the file you are currently looking at.

          In short: they are complementary!

  4. Absolutely amazing! Avdi, you made my day! Thank you very much! Now I love emacs far more! Emacs rocks!

Comments are closed.