Git fork
at reftables-rust 161 lines 5.7 kB view raw
1git-reflog(1) 2============= 3 4NAME 5---- 6git-reflog - Manage reflog information 7 8 9SYNOPSIS 10-------- 11[synopsis] 12git reflog [show] [<log-options>] [<ref>] 13git reflog list 14git reflog exists <ref> 15git reflog write <ref> <old-oid> <new-oid> <message> 16git reflog delete [--rewrite] [--updateref] 17 [--dry-run | -n] [--verbose] <ref>@{<specifier>}... 18git reflog drop [--all [--single-worktree] | <refs>...] 19git reflog expire [--expire=<time>] [--expire-unreachable=<time>] 20 [--rewrite] [--updateref] [--stale-fix] 21 [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...] 22 23DESCRIPTION 24----------- 25This command manages the information recorded in the reflogs. 26 27Reference logs, or "reflogs", record when the tips of branches and 28other references were updated in the local repository. Reflogs are 29useful in various Git commands, to specify the old value of a 30reference. For example, `HEAD@{2}` means "where HEAD used to be two 31moves ago", `master@{one.week.ago}` means "where master used to point 32to one week ago in this local repository", and so on. See 33linkgit:gitrevisions[7] for more details. 34 35The command takes various subcommands, and different options 36depending on the subcommand: 37 38The "show" subcommand (which is also the default, in the absence of 39any subcommands) shows the log of the reference provided in the 40command-line (or `HEAD`, by default). The reflog covers all recent 41actions, and in addition the `HEAD` reflog records branch switching. 42`git reflog show` is an alias for `git log -g --abbrev-commit 43--pretty=oneline`; see linkgit:git-log[1] for more information. 44 45The "list" subcommand lists all refs which have a corresponding reflog. 46 47The "exists" subcommand checks whether a ref has a reflog. It exits 48with zero status if the reflog exists, and non-zero status if it does 49not. 50 51The "write" subcommand writes a single entry to the reflog of a given 52reference. This new entry is appended to the reflog and will thus become 53the most recent entry. The reference name must be fully qualified. Both the old 54and new object IDs must not be abbreviated and must point to existing objects. 55The reflog message gets normalized. 56 57The "delete" subcommand deletes single entries from the reflog, but 58not the reflog itself. Its argument must be an _exact_ entry (e.g. "`git 59reflog delete master@{2}`"). This subcommand is also typically not used 60directly by end users. 61 62The "drop" subcommand completely removes the reflog for the specified 63references. This is in contrast to "expire" and "delete", both of which 64can be used to delete reflog entries, but not the reflog itself. 65 66The "expire" subcommand prunes older reflog entries. Entries older 67than `expire` time, or entries older than `expire-unreachable` time 68and not reachable from the current tip, are removed from the reflog. 69This is typically not used directly by end users -- instead, see 70linkgit:git-gc[1]. 71 72OPTIONS 73------- 74 75Options for `show` 76~~~~~~~~~~~~~~~~~~ 77 78`git reflog show` accepts any of the options accepted by `git log`. 79 80 81Options for `delete` 82~~~~~~~~~~~~~~~~~~~~ 83 84`git reflog delete` accepts options `--updateref`, `--rewrite`, `-n`, 85`--dry-run`, and `--verbose`, with the same meanings as when they are 86used with `expire`. 87 88Options for `drop` 89~~~~~~~~~~~~~~~~~~ 90 91`--all`:: 92 Drop the reflogs of all references from all worktrees. 93 94`--single-worktree`:: 95 By default when `--all` is specified, reflogs from all working 96 trees are dropped. This option limits the processing to reflogs 97 from the current working tree only. 98 99 100Options for `expire` 101~~~~~~~~~~~~~~~~~~~~ 102 103`--all`:: 104 Process the reflogs of all references. 105 106`--single-worktree`:: 107 By default when `--all` is specified, reflogs from all working 108 trees are processed. This option limits the processing to reflogs 109 from the current working tree only. 110 111`--expire=<time>`:: 112 Prune entries older than the specified time. If this option is 113 not specified, the expiration time is taken from the 114 configuration setting `gc.reflogExpire`, which in turn 115 defaults to 90 days. `--expire=all` prunes entries regardless 116 of their age; `--expire=never` turns off pruning of reachable 117 entries (but see `--expire-unreachable`). 118 119`--expire-unreachable=<time>`:: 120 Prune entries older than `<time>` that are not reachable from 121 the current tip of the branch. If this option is not 122 specified, the expiration time is taken from the configuration 123 setting `gc.reflogExpireUnreachable`, which in turn defaults 124 to 30 days. `--expire-unreachable=all` prunes unreachable 125 entries regardless of their age; `--expire-unreachable=never` 126 turns off early pruning of unreachable entries (but see 127 `--expire`). 128 129`--updateref`:: 130 Update the reference to the value of the top reflog entry (i.e. 131 <ref>@\{0\}) if the previous top entry was pruned. (This 132 option is ignored for symbolic references.) 133 134`--rewrite`:: 135 If a reflog entry's predecessor is pruned, adjust its "old" 136 SHA-1 to be equal to the "new" SHA-1 field of the entry that 137 now precedes it. 138 139`--stale-fix`:: 140 Prune any reflog entries that point to "broken commits". A 141 broken commit is a commit that is not reachable from any of 142 the reference tips and that refers, directly or indirectly, to 143 a missing commit, tree, or blob object. 144+ 145This computation involves traversing all the reachable objects, i.e. it 146has the same cost as 'git prune'. It is primarily intended to fix 147corruption caused by garbage collecting using older versions of Git, 148which didn't protect objects referred to by reflogs. 149 150`-n`:: 151`--dry-run`:: 152 Do not actually prune any entries; just show what would have 153 been pruned. 154 155`--verbose`:: 156 Print extra information on screen. 157 158 159GIT 160--- 161Part of the linkgit:git[1] suite