Get the current git hash in a Python script
No need to hack around getting data from the git command yourself. GitPython is a very nice way to do this and a lot of other git stuff. It even has “best effort” support for Windows. After pip install gitpython you can do import git repo = git.Repo(search_parent_directories=True) sha = repo.head.object.hexsha Something to consider when … Read more