git-rev-list - Linux


git-rev-list displays the commit history of a repository or a specified commit range. It provides a list of commits, each represented by its commit ID (SHA-1 hash). This command is useful for exploring the history of your project, finding specific commits, and generating input for other Git commands.


git rev-list [<options>] [<rev-list-spec>]


  • -n : Limit the output to the specified number of commits.
  • –[no-]decorate: Display commit summaries in a decorated or plain format. Default is true (decorated).
  • –[no-]simplify-by-decoration: Simplify decorated commits by ignoring submodules and untracked files. Default is true (simplify).
  • –max-count=: Limit the maximum number of commits to be shown.
  • –cherry-pick: Show only the commits that are not present in the current branch.
  • –remotes: Include commits from remote branches.
  • –all: Show all commits, not limited to the specified range.
  • –boundary: Treat the specified commit as a boundary and only show commits before or after it.
  • –until=: Display commits up to, but not including, the specified commit.
  • –since=: Display commits since, but not including, the specified commit.
  • –count: Display only the count of commits matching the specified criteria.
  • –first-parent: Follow only the first parent of each commit.


  • Display the last 10 commits in the history:

    git rev-list -n 10
  • Show a list of all commits with simplified summaries:

    git rev-list --no-decorate
  • Display commits that are not in the current branch:

    git rev-list --cherry-pick
  • Get the list of commits from the remote master branch:

    git rev-list remotes/origin/master

Common Issues

  • No output: Verify that the specified commit range is valid and exists in the repository.
  • Too many commits: Use the --max-count option to limit the output or specify a specific commit range.
  • Unexpected commit order: Remember that commits are listed in reverse chronological order. Use the --reverse option to change the order.


git-rev-list can be combined with other commands to perform more complex tasks. For example:

  • Generate a list of commits and pipe it to git show to display the full commit summaries:

    git rev-list | git show
  • Use git-rev-list as input for git cherry-pick to select the commits to cherry-pick:

    git cherry-pick -n $(git rev-list --cherry-pick)

Related Commands

  • git log: Display the commit history in a more user-friendly format.
  • git whatchanged: Show the changes between two commits.
  • git diff: Compare the contents of two commits.