How to View Commit History in Git (git log)
git log displays the commit history of the current branch, most recent commit first.
Published September 27, 2026
git log shows the commit history of the current branch, newest first, including hash, author, date and message.
How it works
Options filter and format the output: by author, date, file or message text, and graph views of branches.
Use git log -p to see the patch for each commit.
Try it
git log -3
commit a1b2c3d Author: Ada Date: Mon Fix login
commit d4e5f6a Author: Bob Date: Sun Add search
Practical examples
Limit and filter
git log -5
git log --author="Ada" --since="2 weeks ago"History of one file
git log -p -- src/app.jsSearch messages
git log --grep="login"Graph view
git log --graph --oneline --allCommon mistakes
- Forgetting the pager (press q to quit).
- Reading the wrong branch's history.
- Missing renamed files without --follow.
Key takeaways
- git log lists commits.
- Filter by author, date, file, text.
- --graph shows branches.
FAQ
How do I exit?
Press q.
Follow renames?
git log --follow -- file.