git-reflog - Linux


git reflog displays a history of references and the operations that have changed them. It’s useful for troubleshooting and recovering from mistakes.


git reflog [<options>] [<revision range>]


  • -n : Show the last <count> entries.
  • -v: Display the full log entry including annotated tags.
  • -M: Hide merges.
  • -h: Display help.


View the last 10 log entries:

git reflog -n 10

Display the full log entry with tags:

git reflog -v

Hide merges from the log:

git reflog -M

Common Issues

Error: Reflog is empty:

This occurs if the repository is new or if the reflog has been pruned. Use git gc to prune the reflog to recover disk space.

Error: Could not parse object:

This indicates a corrupted object in the Git repository. Run git fsck to check for and repair any corruption.


git reflog can be used with other commands to track and manage changes. For example, it can be used with git bisect to help find the root cause of a regression.

Related Commands

  • git blame: Displays the history of changes for each line of a file.
  • git log: Displays the history of commits.