git log Show the history of commits

Lists commits from newest to oldest with author, date and message. With options it can draw branch graphs, filter by author or date, and show file changes.

Synopsis

git log [OPTION]... [REVISION] [-- PATH]

Common options

Option or formWhat it does
--onelineOne short line per commit
--graphDraw the branch structure as a text graph
-n N, -NShow only the last N commits
--author=NAMEOnly commits by someone matching NAME
--since=DATEOnly commits after a date, such as "2 weeks ago"
-pShow the change made by each commit
--statShow which files each commit touched
-S TEXTFind commits that added or removed that exact text

Examples

Compact history
git log --oneline -10
3f2a9c1 Add contact form
8b1d7e4 Fix header spacing
See branches as a graph
git log --oneline --graph --all
History of one file
git log --follow -p -- src/app.js
Your own recent work
git log --author="Ana" --since="1 week ago" --oneline
Find when a string appeared
git log -S"API_KEY" --oneline

Notes

See also

Last reviewed 2026-10-09.