Git 101: log vs reflog

Nov 11, 2022 · 1 min read · Post a comment

There are two commands you could use to list Git commit history including: git log and git reflog. For more details see How to list all commits in a Git repository. However, there must be some difference since you can’t have two commands doing exactly the same thing, right?! The devil is in the details.


  • Git


It all comes down to private vs public records.

git reflog keeps track of everything you are doing on your local machine such as: checking out, committing, hard resetting, amending commits, and everything in between. To be precise, reflog stores the local recordings of all commits (SHA-1 commit IDs) that are referenced in your repo in the last 90 days in an ordered list. This metadata is available as part of .git/log/HEAD file and under .git/logs/refs/heads/ subdirectory.

Simply put, reflog follows and track the history of every commit HEAD points to. Not being part of the repo itself.

git log is a command that lists the whole “public” Git repo commit history. It traverses recursively through the Git tree and lookup every commit’s parent.

Basically, git log shows the history of all commits for the current branch. Part of the repo itself, as it’s duplicated on every push, fetch or pull.


To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.