git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: blame vs annotate?

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2008, 18:10 UTC
Message-ID
<7v8wu9cd7i.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<57518fd10809030943i35af222fw82cf591c737b8c04@mail.gmail.com>
"Jonathan del Strother" <maillist@steelskies.com> writes:
> What's the difference between 'git blame' & 'git annotate'?  The
> output is practically identical - it's not obvious when you would use
> one over the other

In short, don't use git-annotate unless you are an ancient script that was written before git-blame was written. They are functionally equivalent, uses the same blame assigning engine, and the only difference is the default output format, and blame knows how to mimick annotate output.

History.

The first implementation was called git-annotate that was implemented in Perl.

    c65e898 (Add git-annotate, a tool for assigning blame., 2006-02-20)
A competing implementation in C was done and was called git-blame:
    cbfb73d (Add git-blame, a tool for assigning blame., 2006-02-21)

They competed for a while but it became more and more apparent that blame was a better implementation. After blame learned to mimick annotate output, which some scripts depended on, Perl implementation was retired, but the name git-annotate was left as a backward compatibility alias:

    f789e34 (Remove git-annotate.perl and create a builtin-alias for git-blame, 2006-10-09)

Then as an experiment, a reimplementation of blame in C, confusingly codenamed git-pickaxe, was started, to detect code movements across and within files:

    cee7f24 (git-pickaxe: blame rewritten., 2006-10-19)

This had the same output format as git-blame, also with compatibility output format implemented for the older git-annotate. After it matured, it took over the original git-blame name.

    acca687 (git-pickaxe: retire pickaxe, 2006-11-08)
Previous: Petr BaudisNext: Matthieu Moy
Message 4 of 17 in “blame vs annotate?”
  1. Jonathan del StrotherSep 3, 2008
  2. Miklos VajnaSep 3, 2008
  3. Petr BaudisSep 3, 2008
  4. Junio C HamanoSep 3, 2008
  5. Matthieu MoySep 4, 2008
  6. Sverre RabbelierSep 4, 2008
  7. Mention the fact that 'git annotate' is only for backward compatibility.Matthieu Moy, Sep 4, 2008
  8. Petr BaudisSep 4, 2008
  9. Mention the fact that 'git annotate' is only for backward compatibility.Matthieu Moy, Sep 4, 2008
  10. Junio C HamanoSep 4, 2008
  11. Junio C HamanoSep 4, 2008
  12. Matthieu MoySep 5, 2008
  13. Junio C HamanoSep 5, 2008
  14. Petr BaudisSep 5, 2008
  15. Matthieu MoySep 5, 2008
  16. Junio C HamanoSep 5, 2008
  17. Jakub NarebskiSep 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.