Searching history
A huge number and variety of useful options to the git log
command are 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 the specific versions, utilizing information other than the shape of the DAG of revisions.
Limiting the number of revisions
The most basic way of limiting the git log
output, the simplest limiting option, is to show only then most recent commits. This is done using the -<n>
option (where n
is any integer); this can be also 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 ...
Get Mastering Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.