pygit2

Python bindings for libgit2, enabling Git operations in Python code

brewmacoslinux
Try with needOr install directly
Source

About

Bindings to the libgit2 shared library

Commands

pygit2

Examples

Clone a Git repository$ python3 -c "import pygit2; pygit2.clone_repository('https://github.com/user/repo.git', 'repo')"
Open an existing repository and get commit info$ python3 -c "import pygit2; repo = pygit2.Repository('.'); commit = repo[repo.head.target]; print(commit.message)"
List all branches in a repository$ python3 -c "import pygit2; repo = pygit2.Repository('.'); [print(b) for b in repo.listall_branches()]"