Skip to main content

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.5.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastgit-0.0.5-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file fastgit-0.0.5.tar.gz.

File metadata

  • Download URL: fastgit-0.0.5.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastgit-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ccf8305ea9d3321d71e404dfa77e7edf5ca6fbfc41eae341956bbbc695a8a005
MD5 76d37e129e57c6cd49ee628758fb9cfe
BLAKE2b-256 3253e2c9dcaa3171850d638b544973c1baf97ca7893db26373386537a0e5911b

See more details on using hashes here.

File details

Details for the file fastgit-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: fastgit-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastgit-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5ccefbbab3339e649f3e775ddde319d54f09826ae8d4ab17182d6e185a6028e3
MD5 f041c8fc2fb8b43e96ba3efd49fe88ed
BLAKE2b-256 49f8d268b22ac640fa883b5f4e8b7e22dca3f4e80b582f99429cf31876a9b9ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page