I would recommend GitPython which is full featured, very well documented and easy to use IMO. For more info, check out this answer

Answer from Daniel Perez on Stack Overflow
🌐
GitHub
github.com › gitpython-developers › GitPython
GitHub - gitpython-developers/GitPython: GitPython is a python library used to interact with Git repositories. · GitHub
This project is in maintenance mode, which means that · …there will be no feature development, unless these are contributed · …there will be no bug fixes, unless they are relevant to the safety of users, or contributed · …issues will ...
Starred by 5.1K users
Forked by 968 users
Languages   Python
Discussions

GitPython can stage changes for commit that git won't commit
Steps to reproduce: Check out the active branch. Make an IndexFile object Stage changes by calling .add() on that object Write that object's state using .write() Make a commit using the git bin... More on github.com
🌐 github.com
7
February 26, 2021
python - Get changed files using gitpython - Stack Overflow
I want to get a list of changed files of the current git-repo. The files, that are normally listed under Changes not staged for commit: when calling git status. So far I have managed to connected... More on stackoverflow.com
🌐 stackoverflow.com
repo.index.diff( head ) show new file as deleted
My goal is to use GitPython to get the same information that git status will return. I'm using the examples from the Tutorial. I have a test repo with the following status: $ git status On bran... More on github.com
🌐 github.com
4
May 5, 2016
Gitpython how to check if a package is up to date?
I found a really hacky solution. It checks if the repo that just pulled is up to date: with open(gitpath + '/.git/FETCH_HEAD') as head: headBeforePull = head.readline() origin.pull() with open(gitpath + '/.git/FETCH_HEAD') as head: headAfterPull = head.readline() if headBeforePull == headAfterPull: print(repo + ' is already up to date') else: print(repo + ' is updated') Thank you to everyone who helped! More on reddit.com
🌐 r/learnpython
11
2
February 3, 2022
🌐
Readthedocs
gitpython.readthedocs.io › en › stable › tutorial.html
GitPython Tutorial — GitPython 3.1.46 documentation
Additionally, GitPython adds functionality to track a specific branch, instead of just a commit. Supported by customized update methods, you are able to automatically update submodules to the latest revision available in the remote repository, as well as to keep track of changes and movements of these submodules. To use it, set the name of the branch you want to track to the submodule.$name.branch option of the .gitmodules file, and use GitPython update methods on the resulting repository with the to_latest_revision parameter turned on.
🌐
Azzamsa
azzamsa.com › n › gitpython-intro
Getting Started with GitPython - azzamsa.com
December 14, 2019 - In the previous chapter, we learn that GitPython offers pure python function or git command implementation. The latter is faster but more resource-intensive. In this step, I will use both of them to give you a closer look at how to do things in both ways. We don't have anything yet. >>> repo.git.status() 'On branch master\n\nNo commits yet\n\nnothing to commit (create/copy files and use "git add" to track)'
🌐
PyPI
pypi.org › project › git-status
git-status
April 14, 2020 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
GitHub
github.com › gitpython-developers › GitPython › issues › 1185
GitPython can stage changes for commit that git won't commit · Issue #1185 · gitpython-developers/GitPython
February 26, 2021 - Steps to reproduce: Check out the active branch. Make an IndexFile object Stage changes by calling .add() on that object Write that object's state using .write() Make a commit using the git binary on the system (instead of using .commit(...
Author   LinuxMercedes
🌐
Readthedocs
gitpython.readthedocs.io › en › 0.1.7 › reference.html
API Reference — GitPython 0.1.7 documentation
Return the status of the index. ... Working tree changes that have not been staged will not be detected ! ... The Commit for a treeish, and all commits leading to it. ... keyword arguments specifying flags to be used in git-log command, i.e.: max_count=1 to limit the amount of commits returned
Find elsewhere
🌐
PyPI
pypi.org › project › git-status-checker
git-status-checker
April 14, 2020 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Waylon Walker
waylonwalker.com › python-git
Using Git from Python - Waylon Walker
April 30, 2022 - Requesting the git status can be done as follows.
🌐
GitHub
github.com › gitpython-developers › GitPython › issues › 133
`git status` output has changed in git 1.8.5 · Issue #133 · gitpython-developers/GitPython
January 28, 2014 - In git versions > 1.8.4, the output of git status has changed such that the lines no longer have a "#" comment prefix by default. (See status.displayCommentPrefix in http://git-scm.com/docs/git-config) As a result, Repo.untracked_files() no longer parses the lines correctly.
🌐
GitHub
github.com › gitpython-developers › GitPython › issues › 423
repo.index.diff( head ) show new file as deleted · Issue #423 · gitpython-developers/GitPython
May 5, 2016 - $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage)
Published   May 05, 2016
🌐
GitHub
github.com › MikePearce › Git-Status
GitHub - MikePearce/Git-Status: A small script to show the status of multiple git repos
June 16, 2010 - Options: -h, --help show this help message and exit -d DIRNAME, --dir=DIRNAME The directory to parse sub dirs from -v, --verbose Show the full detail of git status -r REMOTE, --remote=REMOTE Push to the master (remotename:branchname) -p PULL, --pull=PULL Pull from the master (remotename:branchname) -- Warranties/Guarantees -- None, you're on your own.
Starred by 76 users
Forked by 33 users
Languages   Python 100.0% | Python 100.0%
🌐
Read the Docs
app.readthedocs.org › projects › gitpython › downloads › pdf › stable pdf
GitPython Documentation Release 3.1.46 Michael Trier Jan 01, 2026
January 1, 2026 - It would be recommended to use the git source ... GitPython is not suited for long-running processes (like daemons) as it tends to leak system resources.
🌐
Reddit
reddit.com › r/learnpython › gitpython how to check if a package is up to date?
r/learnpython on Reddit: Gitpython how to check if a package is up to date?
February 3, 2022 -

Hello there, for a project I make I need to check if a package is up to date before pulling it with the git package here is what I have in mind:

repo = git.Repo(myrepo)
origin = repo.remote()
if ?packageIsUpToDate()? == True:
origin.pull()
print('The package is updated')
else:
print('The package is already up to date')

This is the ideal way of doing it, if it's not possible pulling and then telling if the package was up to date is another acceptable solution such as:

repo = git.Repo(myrepo)
origin = repo.remote()
origin.pull()
if ?packagePulledSuccsessfully()? == True:
print('The package is updated')
else:
print('The package is already up to date')
🌐
AskPython
askpython.com › home › using gitpython to list all files affected by a commit
Using GitPython to List All Files Affected by a Commit - AskPython
April 10, 2025 - In this post, we’ll explore how to use the Python Git library GitPython to easily get a list of all files affected by a given commit. We’ll look at practical examples using GitPython so you can directly apply this knowledge in your own projects.
🌐
PyPI
pypi.org › project › GitPython
GitPython · PyPI
This project is in maintenance mode, which means that · …there will be no feature development, unless these are contributed · …there will be no bug fixes, unless they are relevant to the safety of users, or contributed · …issues will ...
      » pip install GitPython
    
Published   Jan 01, 2026
Version   3.1.46