]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-reflog.txt
Merge branch 'jn/grep-open'
[thirdparty/git.git] / Documentation / git-reflog.txt
CommitLineData
4aec56d1
JH
1git-reflog(1)
2=============
3
4NAME
5----
6git-reflog - Manage reflog information
7
8
9SYNOPSIS
10--------
cf39f54e 11'git reflog' <subcommand> <options>
4aec56d1
JH
12
13DESCRIPTION
14-----------
cf39f54e
LT
15The command takes various subcommands, and different options
16depending on the subcommand:
17
18[verse]
04c2407e 19'git reflog expire' [--dry-run] [--stale-fix] [--verbose]
cf39f54e 20 [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
04c2407e 21'git reflog delete' ref@\{specifier\}...
04c2407e 22'git reflog' ['show'] [log-options] [<ref>]
4aec56d1
JH
23
24Reflog is a mechanism to record when the tip of branches are
25updated. This command is to manage the information recorded in it.
26
27The subcommand "expire" is used to prune older reflog entries.
28Entries older than `expire` time, or entries older than
04c8ce9c 29`expire-unreachable` time and not reachable from the current
4aec56d1 30tip, are removed from the reflog. This is typically not used
5162e697 31directly by the end users -- instead, see linkgit:git-gc[1].
4aec56d1 32
02783075 33The subcommand "show" (which is also the default, in the absence of any
cf39f54e 34subcommands) will take all the normal log options, and show the log of
97e92e2c
MM
35the reference provided in the command-line (or `HEAD`, by default).
36The reflog will cover all recent actions (HEAD reflog records branch switching
db5d6666 37as well). It is an alias for `git log -g --abbrev-commit --pretty=oneline`;
5162e697 38see linkgit:git-log[1].
97e92e2c
MM
39
40The reflog is useful in various git commands, to specify the old value
41of a reference. For example, `HEAD@\{2\}` means "where HEAD used to be
42two moves ago", `master@\{one.week.ago\}` means "where master used to
f028cdae 43point to one week ago", and so on. See linkgit:gitrevisions[1] for
97e92e2c 44more details.
4aec56d1 45
552cecc2 46To delete single entries from the reflog, use the subcommand "delete"
db5d6666 47and specify the _exact_ entry (e.g. "`git reflog delete master@\{2\}`").
552cecc2 48
4aec56d1
JH
49
50OPTIONS
51-------
52
cb877cd7
JN
53--stale-fix::
54 This revamps the logic -- the definition of "broken commit"
55 becomes: a commit that is not reachable from any of the refs and
56 there is a missing object among the commit, tree, or blob
57 objects reachable from it that is not reachable from any of the
58 refs.
59+
60This computation involves traversing all the reachable objects, i.e. it
0b444cdb 61has the same cost as 'git prune'. Fortunately, once this is run, we
cb877cd7
JN
62should not have to ever worry about missing objects, because the current
63prune and pack-objects know about reflogs and protect objects referred by
64them.
65
4aec56d1
JH
66--expire=<time>::
67 Entries older than this time are pruned. Without the
68 option it is taken from configuration `gc.reflogExpire`,
69 which in turn defaults to 90 days.
70
71--expire-unreachable=<time>::
04c8ce9c 72 Entries older than this time and not reachable from
4aec56d1
JH
73 the current tip of the branch are pruned. Without the
74 option it is taken from configuration
75 `gc.reflogExpireUnreachable`, which in turn defaults to
76 30 days.
77
78--all::
79 Instead of listing <refs> explicitly, prune all refs.
80
cf2756ae
BC
81--updateref::
82 Update the ref with the sha1 of the top reflog entry (i.e.
83 <ref>@\{0\}) after expiring or deleting.
84
85--rewrite::
86 While expiring or deleting, adjust each reflog entry to ensure
87 that the `old` sha1 field points to the `new` sha1 field of the
88 previous entry.
89
a5d41015
MB
90--verbose::
91 Print extra information on screen.
92
4aec56d1
JH
93Author
94------
59eb68aa 95Written by Junio C Hamano <gitster@pobox.com>
4aec56d1
JH
96
97Documentation
98--------------
99Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
100
101GIT
102---
9e1f0a85 103Part of the linkgit:git[1] suite