List file that have changed since last commit with GitPython
You need to pass the name_only
keyword argument - it would automatically be used as --name-only
command-line option when a git command would be issued.
The following is the equivalent of git diff --name-only HEAD~1..HEAD
:
diff = repo.git.diff('HEAD~1..HEAD', name_only=True)print(diff)