<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article lang="en" id="git-annotate(1)">
<articleinfo>
    <title>git-annotate(1)</title>
        <indexterm>
                <primary>git-annotate(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-annotate - Annotate file lines with commit info</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git annotate</emphasis> [options] file [revision]</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Annotates each line in the given file with information from the commit
which introduced the line. Optionally annotate from a given revision.</simpara>
<simpara>The only difference between this command and <xref linkend="git-blame(1)"/> is that
they use slightly different output formats, and this command exists only
for backward compatibility to support existing scripts, and provide more
familiar command name for people coming from other SCM systems.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
-b
</term>
<listitem>
<simpara>
        Show blank SHA-1 for boundary commits.  This can also
        be controlled via the <literal>blame.blankboundary</literal> config option.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--root
</term>
<listitem>
<simpara>
        Do not treat root commits as boundaries.  This can also be
        controlled via the <literal>blame.showroot</literal> config option.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--show-stats
</term>
<listitem>
<simpara>
        Include additional statistics at the end of blame output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-L &lt;start&gt;,&lt;end&gt;
</term>
<listitem>
<simpara>
        Annotate only the given line range.  &lt;start&gt; and &lt;end&gt; can take
        one of these forms:
</simpara>
<itemizedlist>
<listitem>
<simpara>
number
</simpara>
<simpara>If &lt;start&gt; or &lt;end&gt; is a number, it specifies an
absolute line number (lines count from 1).</simpara>
</listitem>
<listitem>
<simpara>
/regex/
</simpara>
<simpara>This form will use the first line matching the given
POSIX regex.  If &lt;end&gt; is a regex, it will search
starting at the line given by &lt;start&gt;.</simpara>
</listitem>
<listitem>
<simpara>
+offset or -offset
</simpara>
<simpara>This is only valid for &lt;end&gt; and will specify a number
of lines before or after the line given by &lt;start&gt;.</simpara>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>
-l
</term>
<listitem>
<simpara>
        Show long rev (Default: off).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-t
</term>
<listitem>
<simpara>
        Show raw timestamp (Default: off).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-S &lt;revs-file&gt;
</term>
<listitem>
<simpara>
        Use revs from revs-file instead of calling <xref linkend="git-rev-list(1)"/>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p
</term>
<term>
--porcelain
</term>
<listitem>
<simpara>
        Show in a format designed for machine consumption.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--incremental
</term>
<listitem>
<simpara>
        Show the result incrementally in a format designed for
        machine consumption.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--encoding=&lt;encoding&gt;
</term>
<listitem>
<simpara>
        Specifies the encoding used to output author names
        and commit summaries. Setting it to <literal>none</literal> makes blame
        output unconverted data. For more information see the
        discussion about encoding in the <xref linkend="git-log(1)"/>
        manual page.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--contents &lt;file&gt;
</term>
<listitem>
<simpara>
        When &lt;rev&gt; is not specified, the command annotates the
        changes starting backwards from the working tree copy.
        This flag makes the command pretend as if the working
        tree copy has the contents of the named file (specify
        <literal>-</literal> to make the command read from the standard input).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-M|&lt;num&gt;|
</term>
<listitem>
<simpara>
        Detect moving lines in the file as well.  When a commit
        moves a block of lines in a file (e.g. the original file
        has A and then B, and the commit changes it to B and
        then A), traditional <emphasis>blame</emphasis> algorithm typically blames
        the lines that were moved up (i.e. B) to the parent and
        assigns blame to the lines that were moved down (i.e. A)
        to the child commit.  With this option, both groups of lines
        are blamed on the parent.
</simpara>
<simpara>&lt;num&gt; is optional but it is the lower bound on the number of
alphanumeric characters that git must detect as moving
within a file for it to associate those lines with the parent
commit.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-C|&lt;num&gt;|
</term>
<listitem>
<simpara>
        In addition to <literal>-M</literal>, detect lines copied from other
        files that were modified in the same commit.  This is
        useful when you reorganize your program and move code
        around across files.  When this option is given twice,
        the command looks for copies from all other files in the
        parent for the commit that creates the file in addition.
</simpara>
<simpara>&lt;num&gt; is optional but it is the lower bound on the number of
alphanumeric characters that git must detect as moving
between files for it to associate those lines with the parent
commit.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-h
</term>
<term>
--help
</term>
<listitem>
<simpara>
        Show help message.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_see_also">
<title>SEE ALSO</title>
<simpara><xref linkend="git-blame(1)"/></simpara>
</simplesect>
<simplesect id="_author">
<title>AUTHOR</title>
<simpara>Written by Ryan Anderson &lt;<ulink url="mailto:ryan@michonline.com">ryan@michonline.com</ulink>&gt;.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
