While this question was asked a while ago and I don't know the state of the libraries at that point, it is worth mentioning for searchers that GitPython does a good job of abstracting the command line tools so that you don't need to use subprocess. There are some useful built in abstractions that you can use, but for everything else you can do things like:

import git
repo = git.Repo( '/home/me/repodir' )
print repo.git.status()
# checkout and track a remote branch
print repo.git.checkout( 'origin/somebranch', b='somebranch' )
# add a file
print repo.git.add( 'somefile' )
# commit
print repo.git.commit( m='my commit message' )
# now we are one commit ahead
print repo.git.status()

Everything else in GitPython just makes it easier to navigate. I'm fairly well satisfied with this library and appreciate that it is a wrapper on the underlying git tools.

UPDATE: I've switched to using the sh module for not just git but most commandline utilities I need in python. To replicate the above I would do this instead:

import sh
git = sh.git.bake(_cwd='/home/me/repodir')
print git.status()
# checkout and track a remote branch
print git.checkout('-b', 'somebranch')
# add a file
print git.add('somefile')
# commit
print git.commit(m='my commit message')
# now we are one commit ahead
print git.status()
Answer from underrun on Stack Overflow
🌐
Readthedocs
gitpython.readthedocs.io › en › stable › tutorial.html
GitPython Tutorial — GitPython 3.1.46 documentation
from git import Repo # rorepo is a Repo instance pointing to the git-python repository. # For all you know, the first argument to Repo is a path to the repository you # want to work with.
🌐
GitHub
github.com › gitpython-developers › gitpython
GitHub - gitpython-developers/GitPython: GitPython is a python library used to interact with Git repositories. · GitHub
GitPython is a python library used to interact with Git repositories. - gitpython-developers/GitPython
Starred by 5.1K users
Forked by 969 users
Languages   Python
🌐
Readthedocs
gitpython.readthedocs.io
GitPython Documentation — GitPython 3.1.46 documentation
GitPython Documentation · View page source · Overview / Install · Requirements · Installing GitPython · Limitations · Getting Started · API Reference · Source Code · Questions and Answers · Issue Tracker · License Information · GitPython Quick Start Tutorial ·
🌐
Plain English Westminster
benhoyt.com › writings › pygit
pygit: Just enough of a Git client to create a repo, commit, and push itself to GitHub
pygit implements just enough of a Git client (in 500 lines of Python) to create a repo, commit, and push itself to GitHub.
🌐
PyPI
pypi.org › project › git-client
git-client · PyPI
Commit local git repo with message "subject for a git commit", add or rm files, and push changes. You will be prompted to add a body message (skip with 'n'), and you will see a list of untracked, modified, or deleted files.
      » pip install git-client
    
Published   Jun 30, 2025
Version   1.0.1
🌐
Reddit
reddit.com › r/python › pygitzen - a pure python based git client with terminal user interface inspired by lazygit!
r/Python on Reddit: pygitzen - a pure Python based Git client with terminal user interface inspired by LazyGit!
November 2, 2025 -

I've been working on a side project for a while and finally decided to share it with the community. Checkout pygitzen - a terminal-based Git client built entirely in Python, inspired by LazyGit.

What My Project Does

pygitzen is a TUI (Terminal User Interface) for Git repositories that lets you navigate commits, view diffs, track file changes, and manage branches - all without leaving your terminal. Think of it as a Python-native LazyGit.

Target Audience

I'm a terminal-first developer and love tools like htoplazygit, and fzf. So this tool is made with such users in mind. Who loves TUI apps and wanted python solution for app like lazygit etc which can be used in times like where there is restriction to install any thing apart from python package or wanted something pure python based TUIs.

Comparison

Currently there is no pure python based TUI git client.

  • Pure Python (no external git CLI needed)

  • VSCode-style file status panels

  • Branch-aware commit history

  • Push status indicators

  • Vim-style navigation (j/k, h/l)

Try it out!

If you're a terminal-first developer who loves TUIs, give it a shot:

pip install pygitzen

cd <your-git-repo>

pygitzen

Feedback welcome!

This is my first PyPI package, so I'd love feedback on:

  • What features are missing?

  • What could be improved?

  • Is the UI intuitive?

  • Any bugs or issues?

Repo:

https://github.com/SunnyTamang/pygitzen

PyPI installation:

https://pypi.org/project/pygitzen/

Let me know what you think!

Top answer
1 of 11
136

While this question was asked a while ago and I don't know the state of the libraries at that point, it is worth mentioning for searchers that GitPython does a good job of abstracting the command line tools so that you don't need to use subprocess. There are some useful built in abstractions that you can use, but for everything else you can do things like:

import git
repo = git.Repo( '/home/me/repodir' )
print repo.git.status()
# checkout and track a remote branch
print repo.git.checkout( 'origin/somebranch', b='somebranch' )
# add a file
print repo.git.add( 'somefile' )
# commit
print repo.git.commit( m='my commit message' )
# now we are one commit ahead
print repo.git.status()

Everything else in GitPython just makes it easier to navigate. I'm fairly well satisfied with this library and appreciate that it is a wrapper on the underlying git tools.

UPDATE: I've switched to using the sh module for not just git but most commandline utilities I need in python. To replicate the above I would do this instead:

import sh
git = sh.git.bake(_cwd='/home/me/repodir')
print git.status()
# checkout and track a remote branch
print git.checkout('-b', 'somebranch')
# add a file
print git.add('somefile')
# commit
print git.commit(m='my commit message')
# now we are one commit ahead
print git.status()
2 of 11
87

I thought I would answer my own question, since I'm taking a different path than suggested in the answers. Nonetheless, thanks to those who answered.

First, a brief synopsis of my experiences with GitPython, PyGit, and Dulwich:

  • GitPython: After downloading, I got this imported and the appropriate object initialized. However, trying to do what was suggested in the tutorial led to errors. Lacking more documentation, I turned elsewhere.
  • PyGit: This would not even import, and I could find no documentation.
  • Dulwich: Seems to be the most promising (at least for what I wanted and saw). I made some progress with it, more than with GitPython, since its egg comes with Python source. However, after a while, I decided it may just be easier to try what I did.

Also, StGit looks interesting, but I would need the functionality extracted into a separate module and do not want wait for that to happen right now.

In (much) less time than I spent trying to get the three modules above working, I managed to get git commands working via the subprocess module, e.g.

def gitAdd(fileName, repoDir):
    cmd = ['git', 'add', fileName]
    p = subprocess.Popen(cmd, cwd=repoDir)
    p.wait()

gitAdd('exampleFile.txt', '/usr/local/example_git_repo_dir')

This isn't fully incorporated into my program yet, but I'm not anticipating a problem, except maybe speed (since I'll be processing hundreds or even thousands of files at times).

Maybe I just didn't have the patience to get things going with Dulwich or GitPython. That said, I'm hopeful the modules will get more development and be more useful soon.

Find elsewhere
🌐
GitHub
github.com › SunnyTamang › pygitzen
GitHub - SunnyTamang/pygitzen: A Python-native Terminal-Based Git Client - Navigate and manage your Git repositories with a beautiful TUI interface inspired by LazyGit. · GitHub
November 2, 2025 - A Python-native Terminal-Based Git Client - Navigate and manage your Git repositories with a beautiful TUI interface inspired by LazyGit. - SunnyTamang/pygitzen
Author   SunnyTamang
🌐
PyPI
pypi.org › project › GitPython › 0.3.2
GitPython
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
🌐
PyPI
pypi.org › project › GitPython
GitPython · PyPI
GitPython needs the git executable to be installed on the system and available in your PATH for most operations. If it is not in your PATH, you can help GitPython find it by setting the GIT_PYTHON_GIT_EXECUTABLE=<path/to/git> environment variable.
      » pip install GitPython
    
Published   Jan 01, 2026
Version   3.1.46
🌐
Full Stack Python
fullstackpython.com › git.html
Git - Full Stack Python
A Designer's Guide to Git gives a beginner's Git overview for non-programmers. The tutorial also covers using Git clients such as the GitHub desktop application.
🌐
Git
git-scm.com › book › en › v2 › Appendix-B:-Embedding-Git-in-your-Applications-Dulwich
Git - Dulwich
There is also a pure-Python Git implementation - Dulwich. The project is hosted under https://www.dulwich.io/. It aims to provide an interface to Git repositories (both local and remote) that doesn’t call out to Git directly but instead uses pure Python.
🌐
Python GUIs
pythonguis.com › tutorials › getting started with git and github in your python projects
Git and GitHub for Python Projects: A Beginner's Guide to Version Control
March 20, 2023 - If you need something more advanced, then GitKraken is probably a good choice. This tool provides a standalone, cross-platform GUI client for Git that comes with many additional features that can boost your productivity.
🌐
Waylon Walker
waylonwalker.com › python-git
Using Git from Python - Waylon Walker
April 30, 2022 - GitPython is a python api for your git repos, it can be quite handy when you need to work with git from python.
🌐
Dulwich
dulwich.io
Dulwich - Dulwich
Dulwich is a Python implementation of the Git file formats and protocols, which does not depend on Git itself.
🌐
Python Developer's Guide
devguide.python.org › contrib › workflows › install-git
Install Git
As the CPython repo is hosted on GitHub, please refer to either the GitHub setup instructions or the Git project instructions for step-by-step installation directions. You may also want to consider a graphical client such as TortoiseGit or GitHub Desktop.
🌐
PyPI
pypi.org › project › python-git
python-git
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
🌐
GeeksforGeeks
geeksforgeeks.org › python › automating-some-git-commands-with-python
Automating some git commands with Python - GeeksforGeeks
April 28, 2025 - To start automating Git commands with Python, you will first need to install GitPython by running the following command:
🌐
GitHub
github.com › jelmer › dulwich
GitHub - jelmer/dulwich: Pure-Python Git implementation · GitHub
It aims to provide an interface to git repos (both local and remote) that doesn't call out to git directly but instead uses pure Python.
Starred by 2.2K users
Forked by 428 users
Languages   Python