Revision parsing

Repository.revparse_single(revision) → Object

Find an object, as specified by a revision string. See man gitrevisions, or the documentation for git rev-parse for information on the syntax accepted.

You can use any of the fancy <rev> forms supported by libgit2:

>>> commit = repo.revparse_single('HEAD^')