How to get the last commit?
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
Most helpful comment
See documentation: https://gitpython.readthedocs.io/en/stable/tutorial.html#the-commit-object