| 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 expire' [--dry-run] [--stale-fix] [--verbose] | 
| Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 21 | [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>... | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 22 | 'git reflog delete' ref@\{specifier\}... | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 23 | 'git reflog' ['show'] [log-options] [<ref>] | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 24 |  | 
|  | 25 | Reflog is a mechanism to record when the tip of branches are | 
|  | 26 | updated. This command is to manage the information recorded in it. | 
|  | 27 |  | 
|  | 28 | The subcommand "expire" is used to prune older reflog entries. | 
|  | 29 | Entries older than `expire` time, or entries older than | 
| Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 30 | `expire-unreachable` time and not reachable from the current | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 31 | tip, are removed from the reflog. This is typically not used | 
| Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 32 | directly by the end users -- instead, see linkgit:git-gc[1]. | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 33 |  | 
| Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 34 | The subcommand "show" (which is also the default, in the absence of any | 
| Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 35 | subcommands) will take all the normal log options, and show the log of | 
| Junio C Hamano | 2e72a94 | 2007-11-21 08:54:42 | [diff] [blame] | 36 | the reference provided in the command-line (or `HEAD`, by default). | 
|  | 37 | The reflog will cover all recent actions (HEAD reflog records branch switching | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 38 | as well). It is an alias for `git log -g --abbrev-commit --pretty=oneline`; | 
| Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 39 | see linkgit:git-log[1]. | 
| Junio C Hamano | 2e72a94 | 2007-11-21 08:54:42 | [diff] [blame] | 40 |  | 
|  | 41 | The reflog is useful in various git commands, to specify the old value | 
|  | 42 | of a reference. For example, `HEAD@\{2\}` means "where HEAD used to be | 
|  | 43 | two moves ago", `master@\{one.week.ago\}` means "where master used to | 
| Junio C Hamano | c27b733 | 2010-10-14 04:37:28 | [diff] [blame] | 44 | point to one week ago", and so on. See linkgit:gitrevisions[7] for | 
| Junio C Hamano | 2e72a94 | 2007-11-21 08:54:42 | [diff] [blame] | 45 | more details. | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 46 |  | 
| Junio C Hamano | 86bcccc | 2008-03-08 09:33:55 | [diff] [blame] | 47 | To delete single entries from the reflog, use the subcommand "delete" | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 48 | and specify the _exact_ entry (e.g. "`git reflog delete master@\{2\}`"). | 
| Junio C Hamano | 86bcccc | 2008-03-08 09:33:55 | [diff] [blame] | 49 |  | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 50 |  | 
|  | 51 | OPTIONS | 
|  | 52 | ------- | 
|  | 53 |  | 
| Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 54 | --stale-fix:: | 
|  | 55 | This revamps the logic -- the definition of "broken commit" | 
|  | 56 | becomes: a commit that is not reachable from any of the refs and | 
|  | 57 | there is a missing object among the commit, tree, or blob | 
|  | 58 | objects reachable from it that is not reachable from any of the | 
|  | 59 | refs. | 
|  | 60 | + | 
|  | 61 | This computation involves traversing all the reachable objects, i.e. it | 
| Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 62 | has the same cost as 'git prune'. Fortunately, once this is run, we | 
| Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 63 | should not have to ever worry about missing objects, because the current | 
|  | 64 | prune and pack-objects know about reflogs and protect objects referred by | 
|  | 65 | them. | 
|  | 66 |  | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 67 | --expire=<time>:: | 
|  | 68 | Entries older than this time are pruned. Without the | 
|  | 69 | option it is taken from configuration `gc.reflogExpire`, | 
|  | 70 | which in turn defaults to 90 days. | 
|  | 71 |  | 
|  | 72 | --expire-unreachable=<time>:: | 
| Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 73 | Entries older than this time and not reachable from | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 74 | the current tip of the branch are pruned. Without the | 
|  | 75 | option it is taken from configuration | 
|  | 76 | `gc.reflogExpireUnreachable`, which in turn defaults to | 
|  | 77 | 30 days. | 
|  | 78 |  | 
|  | 79 | --all:: | 
|  | 80 | Instead of listing <refs> explicitly, prune all refs. | 
|  | 81 |  | 
| Junio C Hamano | 86bcccc | 2008-03-08 09:33:55 | [diff] [blame] | 82 | --updateref:: | 
|  | 83 | Update the ref with the sha1 of the top reflog entry (i.e. | 
|  | 84 | <ref>@\{0\}) after expiring or deleting. | 
|  | 85 |  | 
|  | 86 | --rewrite:: | 
|  | 87 | While expiring or deleting, adjust each reflog entry to ensure | 
|  | 88 | that the `old` sha1 field points to the `new` sha1 field of the | 
|  | 89 | previous entry. | 
|  | 90 |  | 
| Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 91 | --verbose:: | 
|  | 92 | Print extra information on screen. | 
|  | 93 |  | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 94 | GIT | 
|  | 95 | --- | 
| Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 96 | Part of the linkgit:git[1] suite |