How to get count of unpublished commit with GitPython?
The command you are looking for is:
repo.iter_commits('BRANCH..BRANCH@{u}')
or if you want this as a list:
list(repo.iter_commits('BRANCH..BRANCH@{u}'))
The BRANCH@{u}
syntax refers to the upstream branch of BRANCH
.