Run commands across many Git repositories at once.
mgit applies a Git subcommand or another command to every repository in a selected set, printing each repository name before its output.
Working with a directory full of related repositories often means repeating the same Git command or maintaining an ad hoc shell loop. mgit provides one predictable interface for that work while remaining a standalone Bash script with only Bash 3.2 or later and Git as runtime dependencies.
Repository sets can be discovered at runtime by walking the current directory for Git repositories or predetermined by an optional checked-in .mgit.toml workspace document. Configuration is useful when the set should be explicit and reproducible; it is not required for ordinary discovery.
On macOS or Linux, install the published release with Homebrew:
brew install knowledgeislands/tap/mgitOn any system with Bash and Git, use the release installer:
curl -fsSL https://knowledgeislands.info/install/mgit | bashPass an exact release with bash -s -- vX.Y.Z; omitting it installs the latest release. The installer writes to ~/.local/bin by default. See the mgit tool page and installation guide for alternate directories, shell completion, local development links, and installation checks.
Run mgit without a command to list the selected repositories. Pass a Git subcommand to run it across the set, or use -R to run another command directly. -B passes a command to Git even when mgit owns its name, as in mgit -B worktree list:
mgit
mgit status
mgit sync
mgit sync -i
mgit overview
mgit chain fetch --prune --then pull --ff-only
mgit -R npm test
mgit -v pull
mgit learn st
mgit doctor
mgit diag
mgit help repairmgit sync fetches every tracking branch in parallel, then fast-forwards branches that are only behind, one checkout at a time. It pushes branches that are only ahead only with mgit sync --push; otherwise it names each as ahead N, not pushed (pass --push), and git config mgit.syncPush false stops a repository from ever being pushed by sync. Diverged, dirty, detached and untracked branches are named with a warning and left untouched; nothing is merged or rebased, though a diverged branch's warning says whether a merge would be clean or conflict. It ends with one tally of every repository, in sync, pulled, pushed, skipped and failed, then names each one left behind with its reason and any commits it holds ahead or behind; pass -v for progress on every checkout. Use mgit sync -i to confirm each pull and push separately; an empty answer skips that action.
Ordinary commands run in up to eight checkouts at once (-j/--jobs N sets the limit). Only checkouts with output or a failure are shown, in selection order, followed by one line counting the quiet ones and naming each failure. mgit has no built-in idea of normal output: mgit learn st runs st across the set and, when every checkout, or more than half, prints the same thing once its own branch, remote, path and name are set aside, asks you to confirm, naming any that differed, then saves that as a template in ~/.config/mgit/templates/, so later runs hide checkouts that match it. Pass -v/--verbose for one checkout at a time with all output streamed, as for an interactive command, or --json for one document. Options take the usual forms: -vW groups, -j4 and --jobs=4 attach a value, and words after the command reach Git unchanged.
mgit chain runs several Git commands in order in each checkout, split at each --then; a checkout stops at its first failing step while the others carry on, and one tally counts those that completed, stopped and failed to start; as with ordinary commands, checkouts that complete every step without output are only counted. Save a sequence as a recipe with git config --global mgit.chain.tidy 'fetch --prune --then pull --ff-only' and run it as mgit chain tidy, or mgit tidy when mgit does not own the name.
mgit overview shows, read-only, what is outstanding across the set: dirty files, ahead and behind counts, stashes, worktrees needing attention, and obsolete branches by the Git clean-down criteria. It names only checkouts that need attention, and --json prints one document for tools.
Use mgit register to write an unversioned .mgit.toml document. It writes kind = "workspace" in a non-Git container or kind = "repository" in a repository that owns cross-repository symlink metadata.
Use mgit register --dry-run, or -n, to preview manifest changes. mgit repair performs recognised configuration repair and clones missing repositories after validation. Use mgit repair --dry-run, or -n, to preview without changing files. Inapplicable global selectors fail with a usage error before a management command runs.
Existing schema = 1 manifests remain readable. mgit repair removes the recognised obsolete marker after validation; alternative groups need a manual decision and are refused. mgit doctor evaluates Git and the current manifest without writes, with a verdict and pass/warn/fail/skipped counts; an absent optional manifest is healthy. Both doctor and diag identify the tool, version, installation mode, host platform and architecture, executing Bash runtime, and configuration state. mgit diag omits local paths and configuration error details unless --full is explicit. Health does not assess package updates or repository synchronization.
When ki is installed, optional selectors can use a territory handle, every repository in the registered KI estate, or the territory Capitals (--principals, in KI's order: Knowledge Islands Principal first, then the rest alphabetically). A workspace manifest stores locations, defaulting to local; mgit register add and mgit register rm change that list and refresh its generated members. A repository outside the workspace, such as ../../.local/share/chezmoi, becomes an ordinary [members."PATH"] entry with kind, type and source, and is dispatched once however many workspaces reach it. A plain mgit register refreshes the saved locations later. Ordinary commands read the generated entries without invoking ki.
mgit --territory knowledge-islands status
mgit --estate status
mgit --principals status
mgit register add --territory short --repo ../shared-tools
mgit -t knowledge-islands --filter tools- --filter kit- status
mgit register rm --repo ../shared-toolsRun mgit help, mgit help <command>, or man mgit for the complete command reference.
- User guide — installation, command execution, repository sets, and worktrees.
- Developer guide — local development and verification.
- Changelog — the consolidated pre-1.0 command and feature baseline.
Kris Brown maintains mgit. The repository roadmap is the canonical maintenance queue.
Pull requests are welcome. Follow the developer guide, use Conventional Commit messages, and run its complete verification gate before submitting a change.
MIT © 2026 Kris Brown.
Territory, estate and principals selectors are exclusive and use ki territory roots --null --territory HANDLE, --estate or --principals, passing repeated filters to KI before physical-root checks. Filters match nonempty, literal, case-sensitive directory-basename prefixes with OR semantics, before linked-worktree expansion. Default workspace snapshots use the same prefixes offline. Selected missing roots, missing registration metadata, ambiguous identities, zero matches and incomplete producer output stop dispatch.
Old -a/--agora, agora: locations and Agora snapshot schema are rejected without aliases or automatic migration. Back up the manifest, explicitly replace old locations with verified territory:HANDLE locations and review the snapshot changes before running mgit register --dry-run; see saved-location migration. No user state is deleted by the cut-over.