Use git from python, fast
Project description
fastgit
Usage
Installation
Install latest from pypi
$ pip install fastgit
How to use
In this example we run git init on a directory, add a .gitignore,
and commit it.
import shutil, tempfile
def _git_init(g):
if g.exists: return # Return early if git already initialised
g.init(b='main')
g.config('user.name', 'fastgit')
g.config('user.email', 'fastgit@example.com')
(g.d/".gitignore").mk_write("*.bak")
g.add(".gitignore")
g.commit(m="add .gitignore")
td = tempfile.mkdtemp()
g = Git(td)
_git_init(g)
assert 'add .gitignore' in g.last_commit
print(g.branch('--show-current'))
main
You can also pass path arguments after -- using the __ parameter:
g.log('--oneline', __=['.gitignore'])
'22a9a5d add .gitignore'
shutil.rmtree(td)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastgit-0.0.4.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastgit-0.0.4.tar.gz.
File metadata
- Download URL: fastgit-0.0.4.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
793bdfffa440e5697c74ed265785e38fdede403670aac9c3ac69c34b36f8c92e
|
|
| MD5 |
9b1274b594b3da3927cb068ca206e3da
|
|
| BLAKE2b-256 |
a18ff26c0f69c59682312f40f0992cf95ee9c0cf1c7d1617e0fd932c8a56e3b9
|
File details
Details for the file fastgit-0.0.4-py3-none-any.whl.
File metadata
- Download URL: fastgit-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
726fdd83f5c9b6acacf184ad3a853ef9659c388a9a91ca3cd5ea021dab696bbb
|
|
| MD5 |
3b29846984b7ce67acc0cf50ba8cf5d3
|
|
| BLAKE2b-256 |
ae1915e50865336f4f039c31e53c568eef3537359321f250dd5c96c094594a7a
|