<?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-name-rev(1)">
<articleinfo>
    <title>git-name-rev(1)</title>
        <indexterm>
                <primary>git-name-rev(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-name-rev - Find symbolic names for given revs</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>git name-rev</emphasis> [--tags] [--refs=&lt;pattern&gt;]
               ( --all | --stdin | &lt;committish&gt;&#8230; )</literallayout>
</blockquote>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Finds symbolic names suitable for human digestion for revisions given in any
format parsable by <emphasis>git-rev-parse</emphasis>.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--tags
</term>
<listitem>
<simpara>
        Do not use branch names, but only tags to name the commits
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--refs=&lt;pattern&gt;
</term>
<listitem>
<simpara>
        Only use refs whose names match a given shell pattern.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--all
</term>
<listitem>
<simpara>
        List all commits reachable from all refs
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--stdin
</term>
<listitem>
<simpara>
        Read from stdin, append "(&lt;rev_name&gt;)" to all sha1&#8217;s of nameable
        commits, and pass to stdout
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--name-only
</term>
<listitem>
<simpara>
        Instead of printing both the SHA-1 and the name, print only
        the name.  If given with --tags the usual tag prefix of
        "tags/" is also omitted from the name, matching the output
        of <literal>git-describe</literal> more closely.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-undefined
</term>
<listitem>
<simpara>
        Die with error code != 0 when a reference is undefined,
        instead of printing <literal>undefined</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--always
</term>
<listitem>
<simpara>
        Show uniquely abbreviated commit object as fallback.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_example">
<title>EXAMPLE</title>
<simpara>Given a commit, find out where it is relative to the local refs. Say somebody
wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
Of course, you look into the commit, but that only tells you what happened, but
not the context.</simpara>
<simpara>Enter <emphasis>git-name-rev</emphasis>:</simpara>
<literallayout>% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940</literallayout>
<simpara>Now you are wiser, because you know that it happened 940 revisions before v0.99.</simpara>
<simpara>Another nice thing you can do is:</simpara>
<literallayout>% git log | git name-rev --stdin</literallayout>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Johannes Schindelin &lt;<ulink url="mailto:Johannes.Schindelin@gmx.de">Johannes.Schindelin@gmx.de</ulink>&gt;</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Documentation by Johannes Schindelin.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
