git-rev-list
List commit objects in reverse chronological order
TLDR
List all commits on the current branch
Print the latest commit that changed (add/edit/remove) a specific file on the current branch
List commits more recent than a specific date, on a specific branch
List all merge commits on a specific commit
Print the number of commits since a specific tag
SYNOPSIS
git rev-list [options] [committish]...
PARAMETERS
--all
Pretend as if all refs in refs/ are listed on the command line as <committish>.
--branches[=<pattern>]
Pretend as if all refs in refs/heads are listed on the command line as <committish>. If <pattern> is given, limit branches to ones matching the given shell glob. If pattern doesn’t contain a globbing character (*, ?, or []), globbing is turned off and the pattern has to match the branch name literally.
--tags[=<pattern>]
Pretend as if all refs in refs/tags are listed on the command line as <committish>. If <pattern> is given, limit tags to ones matching the given shell glob. If pattern doesn’t contain a globbing character (*, ?, or []), globbing is turned off and the pattern has to match the tag name literally.
--remotes[=<pattern>]
Pretend as if all refs in refs/remotes are listed on the command line as <committish>. If <pattern> is given, limit remote-tracking branches to ones matching the given shell glob. If pattern doesn’t contain a globbing character (*, ?, or []), globbing is turned off and the pattern has to match the remote-tracking branch name literally.
committish...
A commit object that the command will be processing.
Examples:
SHA-1 expression
refs/heads/branch-name
refs/tags/tag-name
HEAD
--max-count=<number>
Limit the number of commits to output.
--since=<date>
Show commits more recent than a specific date.
--author=<pattern>
Show commits whose author matches a pattern.
--grep=<pattern>
Show commits whose commit message matches a pattern.
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
Select only commits that modify certain files (added, copied, deleted, modified, renamed, type changed, unmerged, unknown, broken). * marks that is a copy/rewrite
--pretty[=<format>]
Pretty-print the contents of the commit logs in a given format.
Examples:
oneline
short
medium
full
fuller
email
raw
format:
--reverse
Output the commits in reverse order.
--topo-order
Output commits in topological order
DESCRIPTION
The `git rev-list` command is a powerful tool for traversing and filtering the commit history of a Git repository. It allows you to select specific commits based on various criteria, such as commit messages, authors, dates, and the files they modify. It's primarily used to feed commit objects into other Git commands, but it can also be used to generate human-readable commit lists. Understanding `git rev-list` is crucial for advanced Git workflows like bisecting, creating custom logs, and scripting Git operations. By default, it prints each commit object ID on a separate line, but many options control the output format and the selection of commits included in the listing. It is very important to notice that the order is reverse chronological order.
PERFORMANCE CONSIDERATIONS
Using complex filters with `git rev-list` can be resource-intensive, especially on large repositories. Consider using `--max-count` or limiting the range of commits to improve performance. Caching mechanisms within Git often mitigate performance issues when running similar commands repeatedly.
HISTORY
The `git rev-list` command has been part of Git since its early days. It's a core command used extensively in Git's internal operations and by users for various tasks related to examining and filtering commit history. Its functionality has been enhanced over time with new options for filtering and formatting the output, making it a versatile tool for advanced Git users.
SEE ALSO
git-log(1), git-show(1), git-bisect(1)