Created
June 29, 2014 02:56
-
-
Save ethanwhite/ba63849c26301f862e4e to your computer and use it in GitHub Desktop.
Get hash of current git HEAD using Python built-ins
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 subprocess | |
process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], shell=False, stdout=subprocess.PIPE) | |
git_head_hash = process.communicate()[0].strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still works for me. Also on Ubuntu 22.04. Python 3.10.10.