Skip to content

Instantly share code, notes, and snippets.

@faroit
Created March 19, 2015 23:13
Show Gist options
  • Save faroit/7682960ec6134f69ebe8 to your computer and use it in GitHub Desktop.
Save faroit/7682960ec6134f69ebe8 to your computer and use it in GitHub Desktop.
Get current commit sha
from git import Repo # requires gitpython
repo_dir = os.path.abspath(os.path.dirname(__file__))
commit = Repo(repo_dir).head.commit.hexsha[:8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment