<?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-reflog(1)">
<articleinfo>
    <title>git-reflog(1)</title>
        <indexterm>
                <primary>git-reflog(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-reflog - Manage reflog information</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git reflog</emphasis> &lt;subcommand&gt; &lt;options&gt;</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>The command takes various subcommands, and different options
depending on the subcommand:</simpara>
<blockquote>
<literallayout><emphasis>git reflog expire</emphasis> [--dry-run] [--stale-fix] [--verbose]
        [--expire=&lt;time&gt;] [--expire-unreachable=&lt;time&gt;] [--all] &lt;refs&gt;&#8230;</literallayout>
</blockquote>
<simpara>+
<emphasis>git reflog delete</emphasis> ref@{specifier}&#8230;</simpara>
<simpara>+
<emphasis>git reflog</emphasis> [<emphasis>show</emphasis>] [log-options] [&lt;ref&gt;]</simpara>
<simpara>Reflog is a mechanism to record when the tip of branches are
updated.  This command is to manage the information recorded in it.</simpara>
<simpara>The subcommand "expire" is used to prune older reflog entries.
Entries older than <literal>expire</literal> time, or entries older than
<literal>expire-unreachable</literal> time and not reachable from the current
tip, are removed from the reflog.  This is typically not used
directly by the end users&#8201;&#8212;&#8201;instead, see <xref linkend="git-gc(1)"/>.</simpara>
<simpara>The subcommand "show" (which is also the default, in the absence of any
subcommands) will take all the normal log options, and show the log of
the reference provided in the command-line (or <literal>HEAD</literal>, by default).
The reflog will cover all recent actions (HEAD reflog records branch switching
as well).  It is an alias for <literal>git log -g --abbrev-commit --pretty=oneline</literal>;
see <xref linkend="git-log(1)"/>.</simpara>
<simpara>The reflog is useful in various git commands, to specify the old value
of a reference. For example, <literal>HEAD@{2}</literal> means "where HEAD used to be
two moves ago", <literal>master@{one.week.ago}</literal> means "where master used to
point to one week ago", and so on. See <xref linkend="git-rev-parse(1)"/> for
more details.</simpara>
<simpara>To delete single entries from the reflog, use the subcommand "delete"
and specify the <emphasis>exact</emphasis> entry (e.g. "<literal>git reflog delete master@{2}</literal>").</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--stale-fix
</term>
<listitem>
<simpara>
        This revamps the logic&#8201;&#8212;&#8201;the definition of "broken commit"
        becomes: a commit that is not reachable from any of the refs and
        there is a missing object among the commit, tree, or blob
        objects reachable from it that is not reachable from any of the
        refs.
</simpara>
<simpara>This computation involves traversing all the reachable objects, i.e. it
has the same cost as <emphasis>git-prune</emphasis>.  Fortunately, once this is run, we
should not have to ever worry about missing objects, because the current
prune and pack-objects know about reflogs and protect objects referred by
them.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--expire=&lt;time&gt;
</term>
<listitem>
<simpara>
        Entries older than this time are pruned.  Without the
        option it is taken from configuration <literal>gc.reflogExpire</literal>,
        which in turn defaults to 90 days.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--expire-unreachable=&lt;time&gt;
</term>
<listitem>
<simpara>
        Entries older than this time and not reachable from
        the current tip of the branch are pruned.  Without the
        option it is taken from configuration
        <literal>gc.reflogExpireUnreachable</literal>, which in turn defaults to
        30 days.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--all
</term>
<listitem>
<simpara>
        Instead of listing &lt;refs&gt; explicitly, prune all refs.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--updateref
</term>
<listitem>
<simpara>
        Update the ref with the sha1 of the top reflog entry (i.e.
        &lt;ref&gt;@{0}) after expiring or deleting.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--rewrite
</term>
<listitem>
<simpara>
        While expiring or deleting, adjust each reflog entry to ensure
        that the <literal>old</literal> sha1 field points to the <literal>new</literal> sha1 field of the
        previous entry.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--verbose
</term>
<listitem>
<simpara>
        Print extra information on screen.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Junio C Hamano &lt;<ulink url="mailto:gitster@pobox.com">gitster@pobox.com</ulink>&gt;</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Documentation by Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
