git log
Display the commit history with detailed information
Practical Example
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.
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/.