Documentation / git-reflog.txton commit Git 1.8.5.1 (a155a5f)
   1git-reflog(1)
   2=============
   3
   4NAME
   5----
   6git-reflog - Manage reflog information
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git reflog' <subcommand> <options>
  13
  14DESCRIPTION
  15-----------
  16The command takes various subcommands, and different options
  17depending on the subcommand:
  18
  19[verse]
  20'git reflog expire' [--dry-run] [--stale-fix] [--verbose]
  21        [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
  22'git reflog delete' ref@\{specifier\}...
  23'git reflog' ['show'] [log-options] [<ref>]
  24
  25Reflog is a mechanism to record when the tip of branches are
  26updated.  This command is to manage the information recorded in it.
  27
  28The subcommand "expire" is used to prune older reflog entries.
  29Entries older than `expire` time, or entries older than
  30`expire-unreachable` time and not reachable from the current
  31tip, are removed from the reflog.  This is typically not used
  32directly by the end users -- instead, see linkgit:git-gc[1].
  33
  34The subcommand "show" (which is also the default, in the absence of any
  35subcommands) will take all the normal log options, and show the log of
  36the reference provided in the command-line (or `HEAD`, by default).
  37The reflog will cover all recent actions (HEAD reflog records branch switching
  38as well).  It is an alias for `git log -g --abbrev-commit --pretty=oneline`;
  39see linkgit:git-log[1].
  40
  41The reflog is useful in various Git commands, to specify the old value
  42of a reference. For example, `HEAD@{2}` means "where HEAD used to be
  43two moves ago", `master@{one.week.ago}` means "where master used to
  44point to one week ago", and so on. See linkgit:gitrevisions[7] for
  45more details.
  46
  47To delete single entries from the reflog, use the subcommand "delete"
  48and specify the _exact_ entry (e.g. "`git reflog delete master@{2}`").
  49
  50
  51OPTIONS
  52-------
  53
  54--stale-fix::
  55        This revamps the logic -- the definition of "broken commit"
  56        becomes: a commit that is not reachable from any of the refs and
  57        there is a missing object among the commit, tree, or blob
  58        objects reachable from it that is not reachable from any of the
  59        refs.
  60+
  61This computation involves traversing all the reachable objects, i.e. it
  62has the same cost as 'git prune'.  Fortunately, once this is run, we
  63should not have to ever worry about missing objects, because the current
  64prune and pack-objects know about reflogs and protect objects referred by
  65them.
  66
  67--expire=<time>::
  68        Entries older than this time are pruned.  Without the
  69        option it is taken from configuration `gc.reflogExpire`,
  70        which in turn defaults to 90 days.  --expire=all prunes
  71        entries regardless of their age; --expire=never turns off
  72        pruning of reachable entries (but see --expire-unreachable).
  73
  74--expire-unreachable=<time>::
  75        Entries older than this time and not reachable from
  76        the current tip of the branch are pruned.  Without the
  77        option it is taken from configuration
  78        `gc.reflogExpireUnreachable`, which in turn defaults to
  79        30 days.  --expire-unreachable=all prunes unreachable
  80        entries regardless of their age; --expire-unreachable=never
  81        turns off early pruning of unreachable entries (but see
  82        --expire).
  83
  84--all::
  85        Instead of listing <refs> explicitly, prune all refs.
  86
  87--updateref::
  88        Update the ref with the sha1 of the top reflog entry (i.e.
  89        <ref>@\{0\}) after expiring or deleting.
  90
  91--rewrite::
  92        While expiring or deleting, adjust each reflog entry to ensure
  93        that the `old` sha1 field points to the `new` sha1 field of the
  94        previous entry.
  95
  96--verbose::
  97        Print extra information on screen.
  98
  99GIT
 100---
 101Part of the linkgit:git[1] suite