I am trying o grasp gitpython module,
hcommit = repo.head.commit
tdiff = hcommit.diff('HEAD~1')
tdiff = hcommit.diff('HEAD^ HEAD')
I figured out how to get the git diff using gitPython.
import git repo = git.Repo("path/of/repo/") # the below gives us all commits repo.commits() # take the first and last commit a_commit = repo.commits() b_commit = repo.commits() # now get the diff repo.diff(a_commit,b_commit)