madgit
madgit is a CLI tool for mass running commands distributed across multiple Git repositories.
Instead of navigating into each directory, you can run a single madgit command to perform operations on every repository within a specified directory.
Commands
--dir <path>: Top-level option that selects the directory containing repositories.clone --file <path>: Clones repositories listed in a file.clone --github <owner>: Clones repositories owned by a GitHub user or organization.clone --gitlab <url-or-owner>: Clones repositories from a GitLab owner or self-hosted instance.clone --forgejo <url-or-owner>: Clones repositories from a Forgejo owner or self-hosted instance.repos --github <owner>: Prints GitHub repository URLs for a user or organization.repos --gitlab <url-or-owner>: Prints GitLab repository URLs for an owner.repos --forgejo <url-or-owner>: Prints Forgejo repository URLs for an owner.status: Runsgit statusin each repository (headers are color-coded: red=needs-sync, yellow=changes, cyan=clean).checkout-main: Checks outmainin each repository, falling back tomasterwhen needed.exec -- <command>: Executes any arbitrary command in each repository.<git-subcommand> [args...]: Unknown top-level commands are forwarded asgit <subcommand> [args...]in each repository.no-git: Lists subdirectories which are not git repositories.
Examples
# Clone repositories from a file to ~/projects
# Clone all repos from a GitHub organization
# Clone from a GitLab user
# Print GitLab repositories for an owner
# List all repositories for a Forgejo owner
# Pull all repositories in current directory
# Stash worktree changes in every repository
# Check status of all repositories in current directory
# Execute custom command in all repositories
# Forward an unsupported command to git in each repository
# Check out the primary branch across mixed repositories
Remote auth
Remote repository discovery works without credentials for public owners, but you can provide API tokens for private repositories or to avoid rate limits.
GITHUB_TOKEN: GitHub API token used forclone --githubandrepos --githubGITLAB_TOKEN: GitLab API token used forclone --gitlabandrepos --gitlabFORGEJO_TOKEN: Forgejo API token used forclone --forgejoandrepos --forgejo
With GITHUB_TOKEN set, GitHub discovery uses the authenticated repository listing and filters it to the requested owner, so private repositories should be included when your token can access them.
Example:
GITHUB_TOKEN=ghp_xxx
Installation
with cargo
madgit is available on crates.io: https://crates.io/crates/madgit
from AUR
from source
To build madgit from source, you'll need the Rust toolchain.
-
Clone the repository:
&& -
Build the project:
-
You will find the executable in:
License
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 wykwit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.