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