fastgit
raw JSON → 0.0.4 verified Fri May 01 auth: no python
A fast and convenient Python library for running git commands programmatically. It wraps git CLI calls with automatic flag conversion (e.g., --oneline for boolean options) and path separation via __ parameter. Version 0.0.4, active development on GitHub.
pip install fastgit Common errors
error AttributeError: module 'fastgit' has no attribute 'git' ↓
cause Using the module name as an attribute before importing the class or the pre-instantiated instance.
fix
Ensure you import correctly: from fastgit import git
error TypeError: Git.log() got an unexpected keyword argument 'oneline' ↓
cause Trying to call git.log(oneline=True) instead of using the CLI-style flag.
fix
Use git.log('--oneline') to pass boolean flags.
Warnings
gotcha Boolean flags are automatically converted: pass True to enable a flag (e.g., git.log('--oneline', True) is wrong; use git.log('--oneline') instead). ↓
fix Use git.log('--oneline') rather than git.log('--oneline', True).
gotcha Path arguments must be passed via the __ parameter, not positional. e.g., git.log('--oneline', __=['file.py']) not git.log('--oneline', 'file.py'). ↓
fix Use git.log('--oneline', __=['path/to/file'])
deprecated There are no known deprecations yet. This is a very early library (v0.0.4). ↓
fix N/A
Imports
- Git
from fastgit import Git - git wrong
from fastgit import Git; git = Git()correctfrom fastgit import git
Quickstart
from fastgit import git
print(git.log('--oneline'))