With git status I can get information about the number of unpublished commits:
git status
ยป git status # On branch master # Your branch is ahead of 'origin/master' by 2 commits. # (use "git push" to publish your local commits) # nothing to commit, working directory clean
I want to get unpublished commits (or invoice) using GitPython. I documented that I found repo.git.status() , but that is not what I want.
repo.git.status()
The command you are looking for is:
repo.iter_commits(' BRANCH..BRANCH@ {u}')
or if you want it to be like a list:
list(repo.iter_commits(' BRANCH..BRANCH@ {u}'))
The syntax BRANCH@ {u} refers to the BRANCH upstream branch.
BRANCH@ {u}
BRANCH