Marti
Marti

Reputation: 21

How to diff a commit with its parent in GitPython

I'm working on a tool to find commits that only contain whitespaces changes using GitPython. In order to do so I need to see what a commit has changed from its parent.

The second answer to the question How to diff a commit with its parent? shows that I can see the differences between a commit and its parent using:

git diff 15dc8^!

What is the equivalent in gitpython?

I would be also happy to get the same information as with

git show $COMMIT

I'm new, I really hope my question follows all the community guidelines!

Upvotes: 1

Views: 629

Answers (1)

Marti
Marti

Reputation: 21

I fixed the issue by using

res = repo.git.show(sha)

Upvotes: 1

Related Questions