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 form | What it does |
|---|---|
--oneline | One short line per commit |
--graph | Draw the branch structure as a text graph |
-n N, -N | Show only the last N commits |
--author=NAME | Only commits by someone matching NAME |
--since=DATE | Only commits after a date, such as "2 weeks ago" |
-p | Show the change made by each commit |
--stat | Show which files each commit touched |
-S TEXT | Find commits that added or removed that exact text |
Examples
git log --oneline -10
3f2a9c1 Add contact form
8b1d7e4 Fix header spacing
git log --oneline --graph --all
git log --follow -p -- src/app.js
git log --author="Ana" --since="1 week ago" --oneline
git log -S"API_KEY" --oneline
Notes
- Press q to leave the pager. Space scrolls down.
- A..B shows commits in B that are not in A, which is handy before a merge or push: git log origin/main..HEAD.
- Add --no-merges to hide merge commits.
See also
Last reviewed 2026-10-09.