SYNOPSIS

git reflog [show] [<log-options>] [<ref>]
git reflog list
git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
        [--rewrite] [--updateref] [--stale-fix]
        [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>…]
git reflog delete [--rewrite] [--updateref]
        [--dry-run | -n] [--verbose] <ref>@{<specifier>}
git reflog exists <ref>

DESCRIPTION

このコマンドは、reflogに記録された情報を管理します。

参照ログ(reference logs)、または "reflogs" は、ブランチのヒントやその他の参照がローカルリポジトリで更新された時期を記録します。reflogは、参照の古い値を指定するために、さまざまなGitコマンドで役立ちます。 たとえば、 HEAD@{2} は「HEADが2移動前にあった位置」を意味し、 master@{one.week.ago} は「masterがこのローカルリポジトリで1週間前を指していた位置」を意味する等々。詳細については gitrevisions(7) を参照してください。

このコマンドは、さまざまなサブコマンドと、サブコマンドに応じて異なるオプションを取ります:

「show」サブコマンド(サブコマンドの指定がない場合のデフォルトでもあります)は、コマンドライン(またはデフォルトでは「HEAD」)で指定される参照のログを表示します。 reflogは最近のすべてのアクションをカバーし、さらに HEAD reflogはブランチの切り替えを記録します。 git reflog showgit log -g --abbrev-commit --pretty=oneline のエイリアスです。詳細については git-log(1) を参照してください。

The "list" subcommand lists all refs which have a corresponding reflog.

「expire」サブコマンドは、古いreflogエントリを刈り取ります。「expire」時間より古いエントリ、または「expire-unreachable」時間より古く、現在の先端から到達できないエントリがreflogから削除されます。これは通常、エンドユーザーが直接使用することはありません。代わりに、 git-gc(1) を参照してください。

「delete」サブコマンドは、reflogから単一のエントリを削除します。 その引数は「正確な」エントリである必要があります(例: git reflog delete master@{2} )。 このサブコマンドは、通常、エンドユーザーが直接使用することもありません。

「exists」サブコマンドは、refにreflogがあるかどうかをチェックします。reflogが存在する場合はゼロのステータスで終了し、存在しない場合はゼロ以外のステータスで終了します。

OPTIONS

showサブコマンド用オプション

git reflog show は、 git log で受け入れられるすべてのオプションを受け入れます。

expireサブコマンド用オプション

--all

Process the reflogs of all references.

--single-worktree

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).

--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.

これの計算では、到達可能なすべてのオブジェクトのトラバースが含まれます。つまり、 git prune と同じコストがかかります。これは主に、reflogによって参照されるオブジェクトを保護しなかった古いバージョンのGitを使用したガベージコレクションによって引き起こされた破損を修正することを目的としています。

-n
--dry-run

Do not actually prune any entries; just show what would have been pruned.

--verbose

Print extra information on screen.

deleteサブコマンド用オプション

git reflog delete は、オプション --updateref-rewrite-n--dry-run と` --verbose` を受け入れます。これらは、 expire で使用される場合と同じ意味です。

GIT

Part of the git(1) suite