get_current_commit

async _AsyncGit.get_current_commit(version: str = None, repo: str = None)str[source]

Get current commit hash. Optionally specify version to get the current commit hash for a branch or tag.

Examples:

>>> g = Git()
>>> await g.get_current_commit()
'ac52b28f551825160785f9ea7e96f86ccc869cc1'
>>> await g.get_current_commit('2.0.0')    # Get the commit hash for the tag 2.0.0
'598584a447ba63212ac3fe798c01941badf1c194'
Parameters
  • version (str) – Optionally specify a branch / tag to get the current commit hash for.

  • repo (str) – Optionally specify a specific local repository path to run git within.

Return str commit_hash

The current Git commit hash