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