Gitpython: How to get the last commit?

Created on 22 Aug 2017  路  4Comments  路  Source: gitpython-developers/GitPython

How to get the last commit?

Q&A

Most helpful comment

import git
repo = git.Repo("local/path/to/repo/")
commit = repo.head.commit

See documentation: https://gitpython.readthedocs.io/en/stable/tutorial.html#the-commit-object

All 4 comments

import git
repo = git.Repo("local/path/to/repo/")
commit = repo.head.commit

See documentation: https://gitpython.readthedocs.io/en/stable/tutorial.html#the-commit-object

Better - read docs, ask questions, e.g. on stackoverflow (it's not an issue).

See http://gitpython.readthedocs.io/en/stable/intro.html#getting-started

I believe this question has been answered.

For those passing through here : https://stackoverflow.com/a/21431791/11120444

Was this page helpful?
0 / 5 - 0 ratings