Searching the history
A huge number and variety of useful options for the git log
command are revising limiting options — that is, options that let you show only a subset of commits. This complements selecting commits to view by passing the appropriate revision range and allows us to search the history for specific versions, utilizing information other than the shape of the graph of revisions.
Limiting the number of revisions
The most basic way of limiting git log
output is to show only the specified number of the most recent commits. This is done using the -<n>
option (where n
is any integer); this can also be written as -n <n>
, or in long form as --max-count=<n>
. For example, git log -2
would show the two last (most recent) commits in the current line of development, starting from the implicit HEAD
revision.
You can skip the first few commits shown with --skip=<n>
.
Matching revision metadata
History limiting options can be divided into...