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