Created
October 28, 2019 10:18
-
-
Save jeremy-rutman/78c71620a07ebd67b0a618c73e6b5711 to your computer and use it in GitHub Desktop.
get the short git hash of current repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import git | |
| repo = git.Repo(search_parent_directories=True) | |
| sha = repo.head.object.hexsha | |
| short_sha = repo.git.rev_parse(sha, short=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment