1GIT-REFLOG(1) Git Manual GIT-REFLOG(1)
2
3
4
6 git-reflog - Manage reflog information
7
9 git reflog <subcommand> <options>
10
11
13 The command takes various subcommands, and different options depending
14 on the subcommand:
15
16 git reflog [show] [log-options] [<ref>]
17 git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
18 [--rewrite] [--updateref] [--stale-fix]
19 [--dry-run | -n] [--verbose] [--all | <refs>...]
20 git reflog delete [--rewrite] [--updateref]
21 [--dry-run | -n] [--verbose] ref@{specifier}...
22 git reflog exists <ref>
23
24
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 moves
29 ago", master@{one.week.ago} means "where master used to point to one
30 week ago in this local repository", and so on. See gitrevisions(7) for
31 more details.
32
33 This command manages the information recorded in the reflogs.
34
35 The "show" subcommand (which is also the default, in the absence of any
36 subcommands) shows the log of the reference provided in the
37 command-line (or HEAD, by default). The reflog covers all recent
38 actions, and in addition the HEAD reflog records branch switching. git
39 reflog show is an alias for git log -g --abbrev-commit
40 --pretty=oneline; see git-log(1) for more information.
41
42 The "expire" subcommand prunes older reflog entries. Entries older than
43 expire time, or entries older than expire-unreachable time and not
44 reachable from the current tip, are removed from the reflog. This is
45 typically not used directly by end users — instead, see git-gc(1).
46
47 The "delete" subcommand deletes single entries from the reflog. Its
48 argument must be an exact entry (e.g. "git reflog delete master@{2}").
49 This subcommand is also typically not used directly by end users.
50
51 The "exists" subcommand checks whether a ref has a reflog. It exits
52 with zero status if the reflog exists, and non-zero status if it does
53 not.
54
56 Options for show
57 git reflog show accepts any of the options accepted by git log.
58
59 Options for expire
60 --all
61 Process the reflogs of all references.
62
63 --expire=<time>
64 Prune entries older than the specified time. If this option is not
65 specified, the expiration time is taken from the configuration
66 setting gc.reflogExpire, which in turn defaults to 90 days.
67 --expire=all prunes entries regardless of their age; --expire=never
68 turns off pruning of reachable entries (but see
69 --expire-unreachable).
70
71 --expire-unreachable=<time>
72 Prune entries older than <time> that are not reachable from the
73 current tip of the branch. If this option is not specified, the
74 expiration time is taken from the configuration setting
75 gc.reflogExpireUnreachable, which in turn defaults to 30 days.
76 --expire-unreachable=all prunes unreachable entries regardless of
77 their age; --expire-unreachable=never turns off early pruning of
78 unreachable entries (but see --expire).
79
80 --updateref
81 Update the reference to the value of the top reflog entry (i.e.
82 <ref>@{0}) if the previous top entry was pruned. (This option is
83 ignored for symbolic references.)
84
85 --rewrite
86 If a reflog entry’s predecessor is pruned, adjust its "old" SHA-1
87 to be equal to the "new" SHA-1 field of the entry that now precedes
88 it.
89
90 --stale-fix
91 Prune any reflog entries that point to "broken commits". A broken
92 commit is a commit that is not reachable from any of the reference
93 tips and that refers, directly or indirectly, to a missing commit,
94 tree, or blob object.
95
96 This computation involves traversing all the reachable objects,
97 i.e. it has the same cost as git prune. It is primarily intended to
98 fix corruption caused by garbage collecting using older versions of
99 Git, which didn’t protect objects referred to by reflogs.
100
101 -n, --dry-run
102 Do not actually prune any entries; just show what would have been
103 pruned.
104
105 --verbose
106 Print extra information on screen.
107
108 Options for delete
109 git reflog delete accepts options --updateref, --rewrite, -n,
110 --dry-run, and --verbose, with the same meanings as when they are used
111 with expire.
112
114 Part of the git(1) suite
115
116
117
118Git 2.18.1 05/14/2019 GIT-REFLOG(1)