reflog
The reflog is a feature of the Git version control system that records changes to the tip of a reference, typically branches and tags, over time. When a commit is created, a branch is moved, or a reset or rebase changes the history, Git updates the reflog entry for the affected reference. Each entry records the commit’s hash, the action that caused the change, the time, and the author identity. This allows users to recover lost commits, identify where a branch moved from, or revert to a previous state even if that state is not reachable through the current branch history.
Reflog entries are stored in the .git/logs directory. For example, refs/heads/main has a logs/HEAD entry and a
Git preserves reflog information for a configurable amount of time, defaulting to 90 days for HEAD and