Skip to main content
Back to command reference
Inspecting History

git log

Display the commit history with detailed information

Practical example

bash
git log --oneline -5           # last 5 commits, one line each
git log --oneline --graph --all  # full branch topology
git log --author="Jane" --since="2026-01-01"

Command overview & how it works

Shows commits in reverse chronological order (newest first) with their hash, author, date, and commit message. Git log is incredibly customizable: use git log --oneline for a compact single-line-per-commit format, git log --graph to visualize branch topology with ASCII art, git log -p to show the actual diff of each commit, and git log --stat for summary statistics. Filter history with git log --author="name" (by author), git log --since="2 weeks ago" (by date), git log --grep="bug" (by commit message), or git log -S"functionName" (by code changes that introduced or removed a string). Combine flags freely — git log --oneline --graph --all is a common daily-driver command to see the full repository state.

Chapter 08 · History & Diff Mastery

Master Git log, diff, and blame offline

Read advanced graph traversals, patch analysis, and investigation workflows in the 97-page offline course — ₹499.

Learn more

Practical tips

  • Use git log --oneline --graph --all for a compact, visual view of the whole repository.
  • Filter by author, date, or message: --author=Alice, --since='2 weeks ago', --grep=bug.
  • Use -S to find which commit introduced or removed a string: git log -S 'TODO' -- src/.

Deep-dive guides & tutorials

In-depth walkthroughs and practical scenarios related to git log

All guides →

Related commands

More from Inspecting History