I want to get a list of modified files of the current git-repo. Files that are usually listed under Changes not staged for commit:upon invocation git status.
So far I have managed to connect to the repository, pull it out and show all unsolicited files:
from git import Repo
repo = Repo(pk_repo_path)
o = self.repo.remotes.origin
o.pull()[0]
print(repo.untracked_files)
But now I want to show all files that have changes (not perfect). Can someone push me in the right direction? I looked at the names of the methods repoand experimented for a while, but I can not find the right solution.
Obviously, I could name repo.git.statusand parse the files, but this is not at all elegant. There must be something better.
Edit: Now that I think about it. More useful would be a function that tells me the status for a single file. For example:
print(repo.get_status(path_to_file))
>>untracked
print(repo.get_status(path_to_another_file))
>>not staged