You can use `--format=%h` to just get the commit hash, so you don't need to use `head`. Also, as above, prefer `subprocess` to `os.popen`