reflog
Git's local record of every position HEAD and each branch has pointed at, used to find and recover commits that no branch points at any more.
In more detail
Each commit, checkout, reset, rebase and merge adds an entry such as HEAD@{2}. After a bad reset or rebase you can find the old commit ID there and create a branch at it with git branch recovered ID. It is local to your clone and entries expire, by default after about 90 days, or 30 for unreachable commits.
Examples
git refloggit branch recovered d4e5f6gRelated terms
- reachable commit — A commit that can be found by starting from a branch, tag or HEAD and following parent links; commits that cannot are unreachable.
- git reset — The command that moves the current branch to another commit, and depending on the mode also resets the staging area and working tree.
- rebase — Moving a series of commits so they start from a different commit, by replaying each one as a new commit with a new ID.
- detached HEAD — The state where HEAD holds a commit ID directly instead of a branch name, so new commits are made but no branch moves to follow them.
Taught in
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows
- Cherry Picking, Reflog, And Getting Work Back — Advanced Git Internals & Distributed Workflows