Skip to content

How to get the last commit? #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
niso120b opened this issue Aug 22, 2017 · 4 comments
Closed

How to get the last commit? #663

niso120b opened this issue Aug 22, 2017 · 4 comments
Labels

Comments

@niso120b
Copy link

How to get the last commit?

@kenodegard
Copy link
Contributor

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

@qneill
Copy link

qneill commented Sep 6, 2017

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

@Byron Byron added the Q&A label Sep 28, 2017
@Byron Byron closed this as completed Sep 28, 2017
@Byron
Copy link
Member

Byron commented Sep 28, 2017

I believe this question has been answered.

@av1m
Copy link

av1m commented Mar 3, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants