Skip to main content

Fetch collections of git projects

Project description

mgit

A small companion for humans who like tidy git checkouts.

Version on pypi Tested with Github Actions Python versions tested

What it is

mgit is a tiny CLI for people who like their git checkouts clean, current, and easy to scan. It gives you a quick read on one repo, or on every repo directly inside a workspace folder.

  • What state did I leave this checkout in?

  • Can I pull, or did I leave work pending here?

  • Is a merged branch still hanging around, waiting to be cleaned?

  • I just wrapped up a branch; can I safely get back to main and clear it away?

mgit is not a git replacement. It is the compact, careful layer for those ordinary moments where you would rather see the answer than reconstruct it from a handful of commands.

The rhythm

Start with a glance:

mgit        # show status here, or across a workspace

Refresh or move forward only when you mean to:

mgit f      # fetch --all --prune, then show the refreshed status
mgit p      # pull --rebase, but never over pending work

And for the wonderfully common PR merged moment:

mgit g      # fetch, return to the default branch, pull, clean this branch

The short names are the intended interface:

  • status / s: show whether anything here needs attention. This is the default.

  • fetch / f: refresh remote refs, then show what changed.

  • pull / p: pull with rebase only when pending work will not be disturbed.

  • main / m: checkout the default branch, even if it is master.

  • branches / b: list local branches with useful small annotations.

  • groom / g: safely finish with the merged branch you are currently on.

The command shape is:

mgit [-v] [--color auto|always|never] [COMMAND] [FOLDER]

You can pass a folder to most commands:

mgit ~/github
mgit f ~/github
mgit g ~/github/mgit

Workspace scans are shallow on purpose: mgit ~/github inspects direct children like ~/github/*/.git and does not crawl nested folders.

What you see

A workspace stays pleasantly skimmable:

    mgit: main ✅
 pickley: main ☑️ [+1🪦] ⌛4w 6d
   runez: feature 🪦 ✏️1
detached: HEAD 👻

In one glance you get:

  • the current branch

  • local diffs and untracked files

  • ahead/behind/gone tracking state

  • fetch freshness

  • a compact hint that a stale local branch is still lurking

means recently refreshed, ☑️ means the local picture may be older, calls out notably stale fetch information, a branch-level 🪦 means its upstream is gone, and 👻 means detached HEAD. A bracket such as [+2🪦+1] says that, besides the current and default branches, two local branches have been proven cleanable and one remains.

For a single checkout, status also prints the pending paths. Workspace output keeps to one line per repo, so you can keep checking a directory full of projects without turning the terminal into a log dump:

mgit ~/github/mgit

Color is automatic on terminals and can be controlled explicitly:

mgit --color auto
mgit --color always
mgit --color never

Safety model

mgit is read-only by default. Asking how things look does not change your repos.

Commands that act are explicit:

  • mgit f updates local remote refs with git fetch --all --prune.

  • mgit p pulls with rebase only when the checkout passes safety checks.

  • mgit g fetches, verifies that the current branch can be cleaned before switching branches, pulls safely, and deletes that local branch only. If it still exists on origin, it deletes that one remote branch only after independently proving that the fetched remote ref is merged or content-equivalent to the fetched default branch; an exact-ref lease prevents deleting a branch that advanced meanwhile. No other branch is deleted. When already on the default branch, it fetches and reports that fact without pulling or cleaning branches. Use mgit m when you only want to switch to the default branch.

Coming next

A larger convenience waiting in the wings is mgit clone: give it a full repo URL and let mgit choose the local destination from simple config rules.

Planned config shape:

locations = [
    { match = "github.com/zsimic/*", dir = "~/github" },
    { match = "github.com/*",        dir = "~/ext" },
    { match = "git.mycompany.com/*", dir = "~/dev" },
]

The goal is predictable placement without memorizing where each family of repos belongs. Status, fetch, pull, main, and groom do not require any mgit config.

Install

Install with pickley or pipx:

pickley install mgit

or:

pipx install mgit

Install from a checkout for development:

git clone https://github.com/zsimic/mgit.git
cd mgit
uv sync
.venv/bin/mgit --help

Develop

Fast local checks:

.venv/bin/pytest -q
ruff check

Full confidence check:

tox

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

mgit-2.0.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

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

mgit-2.0.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file mgit-2.0.0.tar.gz.

File metadata

  • Download URL: mgit-2.0.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mgit-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8f7a42d68af6955402ae09314adc661736a57fb1940a77a863b04023ab95736b
MD5 680f847408bce3ae11ea02d0d6657ce1
BLAKE2b-256 87f84bbcb74b60fe88363098c30824bf02a0eb6903d49bd19caa9e9c37dbd458

See more details on using hashes here.

Provenance

The following attestation bundles were made for mgit-2.0.0.tar.gz:

Publisher: release.yml on zsimic/mgit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mgit-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: mgit-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mgit-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32d063f848ebb41475743215297703cbe295b40edb6f0ae05f3f951313636cf8
MD5 cce76298574f2f80b1edefb5054eb625
BLAKE2b-256 257dc1b3a141001aaa4a22ffd7e39480515390e1257d1998b27655b2b44afec9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mgit-2.0.0-py3-none-any.whl:

Publisher: release.yml on zsimic/mgit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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