GIT-REFLOG(1)
π git-reflog β the Git manual page for managing reflogs π
okay bestie, welcome to git-reflog from the Git manual. This is the page for managing reflog information β aka Git's receipts for your refs β and we're gonna get you all the way together. π
β¨
β¨ NAME β¨
git-reflog β manage reflog information.
πΈ SYNOPSIS πΈ
git reflog [show] [<log-options>] [<ref>]
git reflog list
git reflog exists <ref>
git reflog write <ref> <old-oid> <new-oid> <message>
git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
git reflog drop [--all [--single-worktree] | <refs>...]
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
π¦ DESCRIPTION π¦
Okay so this command manages the information recorded in the reflogs. Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository. Reflogs are useful in various Git commands, to specify the old value of a reference. For example, HEAD@{2} means "where HEAD used to be two moves ago", master@{one.week.ago} means "where master used to point to one week ago in this local repository", and so on. See gitrevisions(7) for more details. π«Ά
The command takes various subcommands, and different options depending on the subcommand:
showβ The "show" subcommand, which is also the default in the absence of any subcommands, shows the log of the reference provided in the command-line (orHEAD, by default). The reflog covers all recent actions, and in addition theHEADreflog records branch switching.git reflog showis an alias forgit log -g --abbrev-commit --pretty=oneline; seegit-log(1)for more information. πlistβ The "list" subcommand lists all refs which have a corresponding reflog. So like, the receipts that actually exist. β¨existsβ The "exists" subcommand checks whether a ref has a reflog. It exits with zero status if the reflog exists, and non-zero status if it does not. vibe check: exists or not. πwriteβ The "write" subcommand writes a single entry to the reflog of a given reference. This new entry is appended to the reflog and will thus become the most recent entry. The reference name must be fully qualified. Both the old and new object IDs must not be abbreviated and must point to existing objects. The reflog message gets normalized. no cap, it's strict about this one. πdeleteβ The "delete" subcommand deletes single entries from the reflog, but not the reflog itself. Its argument must be an exact entry (e.g.git reflog delete master@{2}). This subcommand is also typically not used directly by end users. πdropβ The "drop" subcommand completely removes the reflog for the specified references. This is in contrast to "expire" and "delete", both of which can be used to delete reflog entries, but not the reflog itself. like, drop the whole thing, not just an entry. πexpireβ The "expire" subcommand prunes older reflog entries. Entries older than expire time, or entries older than expire-unreachable time and not reachable from the current tip, are removed from the reflog. This is typically not used directly by end users β instead, seegit-gc(1). lowkey the cleanup crew. π§Ή
π OPTIONS π
Different subcommands get different options, bestie. Here's the full menu. π
π Options for show π
git reflog show accepts any of the options accepted by git log. That's the whole vibe β it's git log's options, slay. β¨
π Options for delete π
git reflog delete accepts these options β same meanings as when they are used with expire:
--updaterefβ same meaning as withexpire.--rewriteβ same meaning as withexpire.-n,--dry-runβ same meaning as withexpire.--verboseβ same meaning as withexpire.
π Options for drop π
--allβ Drop the reflogs of all references from all worktrees.--single-worktreeβ By default when--allis specified, reflogs from all working trees are dropped. This option limits the processing to reflogs from the current working tree only.
π₯ Options for expire π₯
--allβ Process the reflogs of all references.--single-worktreeβ By default when--allis specified, reflogs from all working trees are processed. This option limits the processing to reflogs from the current working tree only.--expire=<time>β Prune entries older than the specified time. If this option is not specified, the expiration time is taken from the configuration settinggc.reflogExpire, which in turn defaults to 90 days.--expire=allprunes entries regardless of their age;--expire=neverturns off pruning of reachable entries (but see--expire-unreachable).--expire-unreachable=<time>β Prune entries older than<time>that are not reachable from the current tip of the branch. If this option is not specified, the expiration time is taken from the configuration settinggc.reflogExpireUnreachable, which in turn defaults to 30 days.--expire-unreachable=allprunes unreachable entries regardless of their age;--expire-unreachable=neverturns off early pruning of unreachable entries (but see--expire).--updaterefβ Update the reference to the value of the top reflog entry (i.e.<ref>@{0}) if the previous top entry was pruned. (This option is ignored for symbolic references.)--rewriteβ If a reflog entry's predecessor is pruned, adjust its "old" SHA-1 to be equal to the "new" SHA-1 field of the entry that now precedes it.--stale-fixβ Prune any reflog entries that point to "broken commits". A broken commit is a commit that is not reachable from any of the reference tips and that refers, directly or indirectly, to a missing commit, tree, or blob object. This computation involves traversing all the reachable objects, i.e. it has the same cost asgit prune. It is primarily intended to fix corruption caused by garbage collecting using older versions of Git, which didn't protect objects referred to by reflogs. π-n,--dry-runβ Do not actually prune any entries; just show what would have been pruned. peek before you yeet. π--verboseβ Print extra information on screen.
π«Ά GIT π«Ά
Part of the git(1) suite. π§
mwah π that's the whole page, bestie. This one is from Git 2.56.0, dated 2026-09-27 β now go manage those reflogs with main character energy β¨π«Άπ
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms