git log
Shows the commit history log.
Syntax
git log [<options>] [<revision-range>] [-- <path>...]
Options
- --oneline: Displays each commit on a single line
- --graph: Draws a text-based graph of the branch structure
- --all: Shows commits from all branches
- -n <number>: Limits the number of commits shown
- --author=<pattern>: Filters commits by author
- --since=<date> / --after=<date>: Shows commits after the given date
- --until=<date> / --before=<date>: Shows commits before the given date
- --grep=<pattern>: Filters commits by message content
- --stat: Shows file change statistics
- -p / --patch: Shows the diff for each commit
- --pretty=<format>: Customizes the output format
Example
git log git log --oneline --graph --all git log -n 5 git log --author="John" --since="2024-01-01"
Tip
git log --oneline --graph --all gives a quick overview of all branches.