Git Git revisions syntax


Many Git commands take revision parameters as arguments. Depending on the command, they denote a specific commit or, for commands which walk the revision graph (such as git-log(1)), all commits which can be reached from that commit. They are usually denoted as <commit>, or <rev>, or <revision> in the syntax description.

The reference documentation for Git revisions syntax is the gitrevisions(7) manpage.

Still missing from this page:

  • [_] Output from git describe, e.g. v1.7.4.2-679-g3bee7fb
  • [_] @ alone as a shortcut for HEAD
  • [_] @{-<n>}, e.g. @{-1}, and - meaning @{-1}
  • [_] <branchname>@{push}
  • [_] <rev>^@, for all parents of <rev>

Needs separate documentation:

  • [_] Referring to blobs and trees in the repository and in the index: <rev>:<path> and :<n>:<path> syntax
  • [_] Revision ranges like A..B, A...B, B ^A, A^1, and revision limiting like -<n>, --since