history

git log

Displays commit history in reverse chronological order with filters for author, date, path, or content. The primary tool for exploring project history.

git log [<options>] [<revision-range>] [<path>]

Common flags

Flag Purpose
--oneline Condense each commit to a single line
--graph Draw an ASCII graph of branch/merge topology
-p Show the patch (diff) introduced by each commit
--stat Show per-file line change counts
--author=<pattern> Filter by commit author
-S<string> Pickaxe: find commits that add or remove <string>
--since=<date> Only commits newer than the given date

Examples

git log --oneline --graph --all

Compact visual history across all branches

git log -p src/api.js

Show every change to a single file with diffs

git log --since="2 weeks ago" --author="Alex"

Recent commits by a specific author

Gotcha

'git log ' after a rename may miss earlier history; add '--follow' to trace across renames.

Related commands

← All Git commands · Git cheat sheet · Git rebase vs merge