The git log
command is for displaying the log of commit messages.
Command | Abbreviated | Description |
---|---|---|
git log --max-count=2 |
-n 2 or -2 |
show the latest two entries from the commit log |
git log --max-count=2 --skip 2 |
skip the latest two entries and show the two before that | |
git log --oneline |
show each log entry in just one line, including abbreviated hash | |
git log --oneline --graph |
shows the branching and merging with lines and where the commits are | |
git log --pretty=oneline |
same as --oneline but with complete hash |
|
git log --pretty=format:"[%an] at [%ad]%n [%h] %s" -5 |
better to read the official docs on how these formats work | |
git log --stat |
shows complete commit message and also information on file changes | |
git log --patch |
-p |
very detailed output with lines changes |
You can also use git shortlog
which can provide helpful summaries, for example, git shortlog -10
shows who did the last 10 commits.
See also: