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.6.tar.gz (7.6 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.6-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastgit-0.0.6.tar.gz
  • Upload date:
  • Size: 7.6 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.6.tar.gz
Algorithm Hash digest
SHA256 9e41c66ec09a71eefa3e6ff32c6ede9f067be529b0e49661b51ad2188ccbb5f9
MD5 e1647799a709cadc70d88ce107b40a21
BLAKE2b-256 04f08abb4aa328704f2668509d592b08db465950ab86ec463c7d896475932210

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastgit-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1141273a0bc7ae983ada15f67e597929d4f5771062bff7f309ecbdc8e419fbdb
MD5 34f911fb7bc56e9bdae7b854a3d361c3
BLAKE2b-256 9a54f5a4791ef32a8f632b13d0ef9c3a8bf3105bd75d0b02956e26a01e0d39de

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