6 git-reflog - Manage reflog information
12 'git reflog' [show] [<log-options>] [<ref>]
14 'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
15 [--rewrite] [--updateref] [--stale-fix]
16 [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
17 'git reflog delete' [--rewrite] [--updateref]
18 [--dry-run | -n] [--verbose] <ref>@{<specifier>}...
19 'git reflog exists' <ref>
23 This command manages the information recorded in the reflogs.
25 Reference logs, or "reflogs", record when the tips of branches and
26 other references were updated in the local repository. Reflogs are
27 useful in various Git commands, to specify the old value of a
28 reference. For example, `HEAD@{2}` means "where HEAD used to be two
29 moves ago", `master@{one.week.ago}` means "where master used to point
30 to one week ago in this local repository", and so on. See
31 linkgit:gitrevisions[7] for more details.
33 The command takes various subcommands, and different options
34 depending on the subcommand:
36 The "show" subcommand (which is also the default, in the absence of
37 any subcommands) shows the log of the reference provided in the
38 command-line (or `HEAD`, by default). The reflog covers all recent
39 actions, and in addition the `HEAD` reflog records branch switching.
40 `git reflog show` is an alias for `git log -g --abbrev-commit
41 --pretty=oneline`; see linkgit:git-log[1] for more information.
43 The "list" subcommand lists all refs which have a corresponding reflog.
45 The "expire" subcommand prunes older reflog entries. Entries older
46 than `expire` time, or entries older than `expire-unreachable` time
47 and not reachable from the current tip, are removed from the reflog.
48 This is typically not used directly by end users -- instead, see
51 The "delete" subcommand deletes single entries from the reflog. Its
52 argument must be an _exact_ entry (e.g. "`git reflog delete
53 master@{2}`"). This subcommand is also typically not used directly by
56 The "exists" subcommand checks whether a ref has a reflog. It exits
57 with zero status if the reflog exists, and non-zero status if it does
66 `git reflog show` accepts any of the options accepted by `git log`.
73 Process the reflogs of all references.
76 By default when `--all` is specified, reflogs from all working
77 trees are processed. This option limits the processing to reflogs
78 from the current working tree only.
81 Prune entries older than the specified time. If this option is
82 not specified, the expiration time is taken from the
83 configuration setting `gc.reflogExpire`, which in turn
84 defaults to 90 days. `--expire=all` prunes entries regardless
85 of their age; `--expire=never` turns off pruning of reachable
86 entries (but see `--expire-unreachable`).
88 --expire-unreachable=<time>::
89 Prune entries older than `<time>` that are not reachable from
90 the current tip of the branch. If this option is not
91 specified, the expiration time is taken from the configuration
92 setting `gc.reflogExpireUnreachable`, which in turn defaults
93 to 30 days. `--expire-unreachable=all` prunes unreachable
94 entries regardless of their age; `--expire-unreachable=never`
95 turns off early pruning of unreachable entries (but see
99 Update the reference to the value of the top reflog entry (i.e.
100 <ref>@\{0\}) if the previous top entry was pruned. (This
101 option is ignored for symbolic references.)
104 If a reflog entry's predecessor is pruned, adjust its "old"
105 SHA-1 to be equal to the "new" SHA-1 field of the entry that
109 Prune any reflog entries that point to "broken commits". A
110 broken commit is a commit that is not reachable from any of
111 the reference tips and that refers, directly or indirectly, to
112 a missing commit, tree, or blob object.
114 This computation involves traversing all the reachable objects, i.e. it
115 has the same cost as 'git prune'. It is primarily intended to fix
116 corruption caused by garbage collecting using older versions of Git,
117 which didn't protect objects referred to by reflogs.
121 Do not actually prune any entries; just show what would have
125 Print extra information on screen.
131 `git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`,
132 `--dry-run`, and `--verbose`, with the same meanings as when they are
138 Part of the linkgit:git[1] suite