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 [--single-worktree] | <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 --single-worktree
64 By default when --all is specified, reflogs from all working trees
65 are processed. This option limits the processing to reflogs from
66 the current working tree only.
67
68 --expire=<time>
69 Prune entries older than the specified time. If this option is not
70 specified, the expiration time is taken from the configuration
71 setting gc.reflogExpire, which in turn defaults to 90 days.
72 --expire=all prunes entries regardless of their age; --expire=never
73 turns off pruning of reachable entries (but see
74 --expire-unreachable).
75
76 --expire-unreachable=<time>
77 Prune entries older than <time> that are not reachable from the
78 current tip of the branch. If this option is not specified, the
79 expiration time is taken from the configuration setting
80 gc.reflogExpireUnreachable, which in turn defaults to 30 days.
81 --expire-unreachable=all prunes unreachable entries regardless of
82 their age; --expire-unreachable=never turns off early pruning of
83 unreachable entries (but see --expire).
84
85 --updateref
86 Update the reference to the value of the top reflog entry (i.e.
87 <ref>@{0}) if the previous top entry was pruned. (This option is
88 ignored for symbolic references.)
89
90 --rewrite
91 If a reflog entry’s predecessor is pruned, adjust its "old" SHA-1
92 to be equal to the "new" SHA-1 field of the entry that now precedes
93 it.
94
95 --stale-fix
96 Prune any reflog entries that point to "broken commits". A broken
97 commit is a commit that is not reachable from any of the reference
98 tips and that refers, directly or indirectly, to a missing commit,
99 tree, or blob object.
100
101 This computation involves traversing all the reachable objects,
102 i.e. it has the same cost as git prune. It is primarily intended to
103 fix corruption caused by garbage collecting using older versions of
104 Git, which didn’t protect objects referred to by reflogs.
105
106 -n, --dry-run
107 Do not actually prune any entries; just show what would have been
108 pruned.
109
110 --verbose
111 Print extra information on screen.
112
113 Options for delete
114 git reflog delete accepts options --updateref, --rewrite, -n,
115 --dry-run, and --verbose, with the same meanings as when they are used
116 with expire.
117
119 Part of the git(1) suite
120
121
122
123Git 2.21.0 02/24/2019 GIT-REFLOG(1)