{
    "mode": "man",
    "parameter": "git-reflog",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/git-reflog/1/json",
    "generated": "2026-06-15T13:46:28Z",
    "synopsis": "git reflog <subcommand> <options>",
    "sections": {
        "NAME": {
            "content": "git-reflog - Manage reflog information\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git reflog <subcommand> <options>\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The command takes various subcommands, and different options depending on the subcommand:\n\ngit reflog [show] [log-options] [<ref>]\ngit reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n[--rewrite] [--updateref] [--stale-fix]\n[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]\ngit reflog delete [--rewrite] [--updateref]\n[--dry-run | -n] [--verbose] ref@{specifier}...\ngit reflog exists <ref>\n\n\nReference logs, or \"reflogs\", record when the tips of branches and other references were\nupdated in the local repository. Reflogs are useful in various Git commands, to specify the\nold value of a reference. For example, HEAD@{2} means \"where HEAD used to be two moves ago\",\nmaster@{one.week.ago} means \"where master used to point to one week ago in this local\nrepository\", and so on. See gitrevisions(7) for more details.\n\nThis command manages the information recorded in the reflogs.\n\nThe \"show\" subcommand (which is also the default, in the absence of any subcommands) shows\nthe log of the reference provided in the command-line (or HEAD, by default). The reflog\ncovers all recent actions, and in addition the HEAD reflog records branch switching. git\nreflog show is an alias for git log -g --abbrev-commit --pretty=oneline; see git-log(1) for\nmore information.\n\nThe \"expire\" subcommand prunes older reflog entries. Entries older than expire time, or\nentries older than expire-unreachable time and not reachable from the current tip, are\nremoved from the reflog. This is typically not used directly by end users — instead, see git-\ngc(1).\n\nThe \"delete\" subcommand deletes single entries from the reflog. Its argument must be an exact\nentry (e.g. \"git reflog delete master@{2}\"). This subcommand is also typically not used\ndirectly by end users.\n\nThe \"exists\" subcommand checks whether a ref has a reflog. It exits with zero status if the\nreflog exists, and non-zero status if it does not.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "Options for show",
                    "content": "git reflog show accepts any of the options accepted by git log.\n"
                },
                {
                    "name": "Options for expire",
                    "content": ""
                },
                {
                    "name": "--all",
                    "content": "Process the reflogs of all references.\n",
                    "long": "--all"
                },
                {
                    "name": "--single-worktree",
                    "content": "By default when --all is specified, reflogs from all working trees are processed. This\noption limits the processing to reflogs from the current working tree only.\n\n--expire=<time>\nPrune entries older than the specified time. If this option is not specified, the\nexpiration time is taken from the configuration setting gc.reflogExpire, which in turn\ndefaults to 90 days.  --expire=all prunes entries regardless of their age; --expire=never\nturns off pruning of reachable entries (but see --expire-unreachable).\n\n--expire-unreachable=<time>\nPrune entries older than <time> that are not reachable from the current tip of the\nbranch. If this option is not specified, the expiration time is taken from the\nconfiguration setting gc.reflogExpireUnreachable, which in turn defaults to 30 days.\n--expire-unreachable=all prunes unreachable entries regardless of their age;\n--expire-unreachable=never turns off early pruning of unreachable entries (but see\n--expire).\n",
                    "long": "--single-worktree"
                },
                {
                    "name": "--updateref",
                    "content": "Update the reference to the value of the top reflog entry (i.e. <ref>@{0}) if the\nprevious top entry was pruned. (This option is ignored for symbolic references.)\n",
                    "long": "--updateref"
                },
                {
                    "name": "--rewrite",
                    "content": "If a reflog entry’s predecessor is pruned, adjust its \"old\" SHA-1 to be equal to the\n\"new\" SHA-1 field of the entry that now precedes it.\n",
                    "long": "--rewrite"
                },
                {
                    "name": "--stale-fix",
                    "content": "Prune any reflog entries that point to \"broken commits\". A broken commit is a commit that\nis not reachable from any of the reference tips and that refers, directly or indirectly,\nto a missing commit, tree, or blob object.\n\nThis computation involves traversing all the reachable objects, i.e. it has the same cost\nas git prune. It is primarily intended to fix corruption caused by garbage collecting\nusing older versions of Git, which didn’t protect objects referred to by reflogs.\n",
                    "long": "--stale-fix"
                },
                {
                    "name": "-n, --dry-run",
                    "content": "Do not actually prune any entries; just show what would have been pruned.\n",
                    "flag": "-n",
                    "long": "--dry-run"
                },
                {
                    "name": "--verbose",
                    "content": "Print extra information on screen.\n",
                    "long": "--verbose"
                },
                {
                    "name": "Options for delete",
                    "content": "git reflog delete accepts options --updateref, --rewrite, -n, --dry-run, and --verbose, with\nthe same meanings as when they are used with expire.\n"
                }
            ]
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                GIT-REFLOG(1)",
            "subsections": []
        }
    },
    "summary": "git-reflog - Manage reflog information",
    "flags": [
        {
            "flag": "",
            "long": "--all",
            "arg": null,
            "description": "Process the reflogs of all references."
        },
        {
            "flag": "",
            "long": "--single-worktree",
            "arg": null,
            "description": "By default when --all is 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 setting gc.reflogExpire, which in turn defaults to 90 days. --expire=all prunes entries regardless of their age; --expire=never turns 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 setting gc.reflogExpireUnreachable, which in turn defaults to 30 days. --expire-unreachable=all prunes unreachable entries regardless of their age; --expire-unreachable=never turns off early pruning of unreachable entries (but see --expire)."
        },
        {
            "flag": "",
            "long": "--updateref",
            "arg": null,
            "description": "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.)"
        },
        {
            "flag": "",
            "long": "--rewrite",
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": "--stale-fix",
            "arg": null,
            "description": "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 as git 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."
        },
        {
            "flag": "-n",
            "long": "--dry-run",
            "arg": null,
            "description": "Do not actually prune any entries; just show what would have been pruned."
        },
        {
            "flag": "",
            "long": "--verbose",
            "arg": null,
            "description": "Print extra information on screen."
        }
    ],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Show a log of changes to local references like HEAD, branches, or tags.",
        "examples": [
            {
                "description": "Show the reflog for `HEAD`",
                "command": "git reflog"
            },
            {
                "description": "Show the reflog for a given branch",
                "command": "git reflog {{branch_name}}"
            },
            {
                "description": "Show only the 5 latest entries in the reflog",
                "command": "git reflog {{-n|--max-count}} 5"
            }
        ]
    }
}