Exibindo o hash do último commit em repositório git Wed 15 January 2020 · desenvolvimento · git, python, shell No shell utilizando comando git: 1 2 3$ export LAST_COMMIT=$(git rev-parse HEAD) $ echo ${LAST_COMMIT} 132a333e8b798c6a6b7defaad21b47ee3ce7a3aa Em Python puro com o módulo GitPython: 1 2 3 4 5>>> import git >>> repo = git.Repo(".") >>> last_commit = str(repo.head.commit) >>> print last_commit 132a333e8b798c6a6b7defaad21b47ee3ce7a3aa Comentários
Comentários