man-pages/man1/git-reflog.1.html
2021-03-31 01:06:50 +01:00

206 lines
6.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-REFLOG</TITLE>
</HEAD><BODY>
<H1>GIT-REFLOG</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-reflog - Manage reflog information
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git reflog</I> &lt;subcommand&gt; &lt;options&gt;
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
The command takes various subcommands, and different options depending on the subcommand:
<P>
<DL COMPACT><DT id="1"><DD>
<PRE>
<I>git reflog</I> [<I>show</I>] [log-options] [&lt;ref&gt;]
<I>git reflog expire</I> [--expire=&lt;time&gt;] [--expire-unreachable=&lt;time&gt;]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all [--single-worktree] | &lt;refs&gt;...]
<I>git reflog delete</I> [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] ref@{specifier}...
<I>git reflog exists</I> &lt;ref&gt;
</PRE>
</DL>
<P>
<P>
Reference logs, or &quot;reflogs&quot;, record when the tips of branches and other references were updated in the local repository. Reflogs are useful in various Git commands, to specify the old value of a reference. For example, <B>HEAD@{2}</B> means &quot;where HEAD used to be two moves ago&quot;, <B>master@{one.week.ago}</B> means &quot;where master used to point to one week ago in this local repository&quot;, and so on. See <B><A HREF="/cgi-bin/man/man2html?7+gitrevisions">gitrevisions</A></B>(7) for more details.
<P>
This command manages the information recorded in the reflogs.
<P>
The &quot;show&quot; subcommand (which is also the default, in the absence of any subcommands) shows the log of the reference provided in the command-line (or <B>HEAD</B>, by default). The reflog covers all recent actions, and in addition the <B>HEAD</B> reflog records branch switching. <B>git reflog show</B> is an alias for <B>git log -g --abbrev-commit --pretty=oneline</B>; see <B><A HREF="/cgi-bin/man/man2html?1+git-log">git-log</A></B>(1) for more information.
<P>
The &quot;expire&quot; subcommand prunes older reflog entries. Entries older than <B>expire</B> time, or entries older than <B>expire-unreachable</B> time and not reachable from the current tip, are removed from the reflog. This is typically not used directly by end users --- instead, see <B><A HREF="/cgi-bin/man/man2html?1+git-gc">git-gc</A></B>(1).
<P>
The &quot;delete&quot; subcommand deletes single entries from the reflog. Its argument must be an <I>exact</I> entry (e.g. &quot;<B>git reflog delete master@{2}</B>&quot;). This subcommand is also typically not used directly by end users.
<P>
The &quot;exists&quot; subcommand checks whether a ref has a reflog. It exits with zero status if the reflog exists, and non-zero status if it does not.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<A NAME="lbAF">&nbsp;</A>
<H3>Options for <B>show</B></H3>
<P>
<B>git reflog show</B> accepts any of the options accepted by <B>git log</B>.
<A NAME="lbAG">&nbsp;</A>
<H3>Options for <B>expire</B></H3>
<P>
--all
<DL COMPACT><DT id="2"><DD>
Process the reflogs of all references.
</DL>
<P>
--single-worktree
<DL COMPACT><DT id="3"><DD>
By default when
<B>--all</B>
is specified, reflogs from all working trees are processed. This option limits the processing to reflogs from the current working tree only.
</DL>
<P>
--expire=&lt;time&gt;
<DL COMPACT><DT id="4"><DD>
Prune entries older than the specified time. If this option is not specified, the expiration time is taken from the configuration setting
<B>gc.reflogExpire</B>, which in turn defaults to 90 days.
<B>--expire=all</B>
prunes entries regardless of their age;
<B>--expire=never</B>
turns off pruning of reachable entries (but see
<B>--expire-unreachable</B>).
</DL>
<P>
--expire-unreachable=&lt;time&gt;
<DL COMPACT><DT id="5"><DD>
Prune entries older than
<B>&lt;time&gt;</B>
that are not reachable from the current tip of the branch. If this option is not specified, the expiration time is taken from the configuration setting
<B>gc.reflogExpireUnreachable</B>, which in turn defaults to 30 days.
<B>--expire-unreachable=all</B>
prunes unreachable entries regardless of their age;
<B>--expire-unreachable=never</B>
turns off early pruning of unreachable entries (but see
<B>--expire</B>).
</DL>
<P>
--updateref
<DL COMPACT><DT id="6"><DD>
Update the reference to the value of the top reflog entry (i.e. &lt;ref&gt;@{0}) if the previous top entry was pruned. (This option is ignored for symbolic references.)
</DL>
<P>
--rewrite
<DL COMPACT><DT id="7"><DD>
If a reflog entry's predecessor is pruned, adjust its &quot;old&quot; SHA-1 to be equal to the &quot;new&quot; SHA-1 field of the entry that now precedes it.
</DL>
<P>
--stale-fix
<DL COMPACT><DT id="8"><DD>
Prune any reflog entries that point to &quot;broken commits&quot;. A broken commit is a commit that is not reachable from any of the reference tips and that refers, directly or indirectly, to a missing commit, tree, or blob object.
<P>
This computation involves traversing all the reachable objects, i.e. it has the same cost as
<I>git prune</I>. It is primarily intended to fix corruption caused by garbage collecting using older versions of Git, which didn't protect objects referred to by reflogs.
</DL>
<P>
-n, --dry-run
<DL COMPACT><DT id="9"><DD>
Do not actually prune any entries; just show what would have been pruned.
</DL>
<P>
--verbose
<DL COMPACT><DT id="10"><DD>
Print extra information on screen.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H3>Options for <B>delete</B></H3>
<P>
<B>git reflog delete</B> accepts options <B>--updateref</B>, <B>--rewrite</B>, <B>-n</B>, <B>--dry-run</B>, and <B>--verbose</B>, with the same meanings as when they are used with <B>expire</B>.
<A NAME="lbAI">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="11"><A HREF="#lbAB">NAME</A><DD>
<DT id="12"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="13"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="14"><A HREF="#lbAE">OPTIONS</A><DD>
<DL>
<DT id="15"><A HREF="#lbAF">Options for <B>show</B></A><DD>
<DT id="16"><A HREF="#lbAG">Options for <B>expire</B></A><DD>
<DT id="17"><A HREF="#lbAH">Options for <B>delete</B></A><DD>
</DL>
<DT id="18"><A HREF="#lbAI">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:14 GMT, March 31, 2021
</BODY>
</HTML>