I have:
I know the following GitPython equivalents to git commands:
repo.index.diff(None)
gives the same result as git diff
- 5 modified but unstaged filesrepo.index.diff('HEAD')
surprisingly gives the same result as git diff --staged
- 2 modified and staged filesThus my question is, what is GitPython equivalent to git diff HEAD
?
P.S. I can merge results of repo.index.diff(None)
and repo.index.diff('HEAD')
to get the desired output but it looks quite stupid...
The following worked for me:
repo = git.Repo('path/to/my/repo')
print(repo.git.diff(repo.commit()))
This showed the diff for both staged and unstaged modifications.