Skip to main content

GitMC -- concurrent asynchronous Git Utilities for operations on massive numbers of Git repos

DOI ci PyPI Download stats

Platform-independent (Linux/Mac/Windows) Git utilities, useful for managing large (100+) numbers of Git repos. Speed is an emphasis throughout, with concurrency via Python stdlib asyncio via asyncio.create_subprocess_exec and pipelining makes operations in effect 100x faster overall as the coroutines simultaneously wait for Git operations (particularly remote operations like "fetch" and "pull"). We have implemented individual concurrent subprocess timeout using asyncio.wait_for so that one Git operation hanging doesn't cause other Git operations to fail--this is good for when a Git login popup may go unnoticed by the human.

GitMC uses command-line Git because PyGit also requires command-line Git installed, and we don't need the advanced functionality.


Also see PyGit-bulk for managing large (100+) numbers of users / teams.

This repo contains a Git pre-commit script with explanation.

Install

Install Git in a way accessible from the command line line

  • Mac: brew install git
  • Linux: apt install git
  • Windows: command line Git.
python -m pip install -e .

Usage

gitbranch : Tells of any non-master branches under directory ~/code

python -m gitutils.email : list all contributor email addresses. To fix unwanted emails use Git-filter-repo

find_missing_file : find directories missing exact fullpath to file

find_matching_file : find directories matching exact fullpath to file

Sync large number of git repos

These assume numerous subdirectories under ~/code. They work very quickly for large numbers (100+) of repos.

  • gitstat check if any local repos have pending changes
  • gitpull Git pulls all repos (suggest gitfetch instead)
  • gitfetch Git fetches all repos, printing a summary of files changed on remote

Place an empty file .nogit in a subdirectory to skip it.

[optional] speedup with https pull

For public repos, to make the Git remote checking go at least twice as fast, and significantly reduce the computational burden when SSH is used for git push (as is recommended), consider the "pushInsteadOf" global Git config. To do this, when cloning a public repo (including ones you're a collaborator on), use git clone https://. This global SSH push config one-time does SSH push for HTTPS-cloned repos:

git config --global url."ssh://github.com/".pushInsteadOf https://github.com/

The pattern matching can be made for all sites by omitting github.com from the command above, or you can refine it for each site, or even for specific usernames by editing the command above. For private repos, simply clone with SSH as usual

Preview all changed Jekyll files

This is for a website made using Jekyll or Hugo:

ActOnChanged . -p

It shows web page previews of all pages changed locally--start the Jekyll or Hugo debug server first e.g. hugo serve

Release files for gitutils 1.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitutils 1.12.1
File Size Uploaded
gitutils-1.12.1.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitutils 1.12.1
File Interpreter ABI Platform
gitutils-1.12.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / gitutils-1.12.1.tar.gz

Download URL gitutils-1.12.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
413d1fc33d3405dae0eb4b08f83d7d0dae7cb5368abe88025a8336c380be0389
BLAKE2b-256 checksum
How to use checksums
851308407945a432aa54777696c1e8934b383a447f9e036334f9c2c8c7a4c11b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / gitutils-1.12.1-py3-none-any.whl

Download URL gitutils-1.12.1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd61b9328535316cedd5bea6b4633205d558a5ec94edb6836ecf2c69ef83b30
BLAKE2b-256 checksum
How to use checksums
40e1c572fc4762fc1def4b7c3a09d48e8fb58810d0ec223c1698c1382a4bf5d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.12.1 This release

2 release files

1.10.0

1 release file

1.9.0

1 release file

1.8.3

1 release file

1.8.2

1 release file

1.8.0

1 release file

1.7.0

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.3

1 release file

1.5.2

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page