LinuxCommandLibrary

git-bulk

Run Git commands across multiple repositories

TLDR

Register the current directory as a workspace

$ git bulk --addcurrent [workspace_name]
copy

Register a workspace for bulk operations
$ git bulk --addworkspace [workspace_name] /[path/to/repository]
copy

Clone a repository inside a specific directory, then register the repository as a workspace
$ git bulk --addworkspace [workspace_name] /[path/to/parent_directory] --from [remote_repository_location]
copy

Clone repositories from a newline-separated list of remote locations, then register them as workspaces
$ git bulk --addworkspace [workspace_name] /[path/to/root_directory] --from /[path/to/file]
copy

List all registered workspaces
$ git bulk --listall
copy

Run a Git command on the repositories of the current workspace
$ git bulk [command] [command_arguments]
copy

Remove a specific workspace
$ git bulk --removeworkspace [workspace_name]
copy

Remove all workspaces
$ git bulk --purge
copy

SYNOPSIS

git-bulk [-h | -V] [-d DIR] [-p N] [-j PATTERN] [--dry-run] [--exclude PATTERN] <git-command> [<args> ...]

PARAMETERS

-h, --help
    Display help message and exit

-V, --version
    Print version information

-d DIR, --directory DIR
    Root directory to scan for repos (default: current dir)

-p N, --parallel N
    Max parallel jobs (default: CPU cores)

-j PATTERN, --include PATTERN
    Shell glob to include matching repo dirs

--dry-run
    Simulate commands without executing

--exclude PATTERN
    Shell glob to exclude repo dirs

--no-color
    Disable colored output

DESCRIPTION

git-bulk is a powerful command-line tool designed for developers managing multiple Git repositories. It enables bulk execution of Git commands across a directory of repositories, saving time on repetitive tasks like updating, fetching, or switching branches in monorepos or multi-repo setups.

Key features include parallel processing for speed, dry-run mode for safety, and flexible directory scanning to detect Git repos automatically. For example, running git-bulk pull fetches and pulls latest changes from all repos in the current directory tree.

Ideal for CI/CD pipelines, large codebases, or teams with many projects, it supports custom Git arguments and filters repos by name or status. It requires Git 2.20+ and works on Linux, macOS, and Windows via WSL. Install via cargo (Rust-based): cargo install git-bulk or from GitHub releases.

By abstracting bulk operations, git-bulk reduces manual scripting needs, minimizes errors, and boosts productivity in polyrepo environments.

CAVEATS

Only detects bare Git repos (.git/ present); ignores nested non-Git dirs. Parallel mode may overwhelm I/O on slow disks. Not a core Git tool—install separately. Errors in one repo don't stop others.

EXAMPLES

git-bulk fetch origin
git-bulk -p 8 --dry-run checkout main
git-bulk -d ~/projects status -s

INSTALLATION

Via Cargo: cargo install git-bulk
Or binaries from https://github.com/michael-lavers/git-bulk/releases (note: link for ref).

HISTORY

Developed by Michael Lavers in 2020 as a Rust crate. Initial release v0.1.0 addressed monorepo pain points. Active on GitHub (overstarred 1k+), with v2.0 in 2023 adding filters and better error reporting. Inspired by tools like pre-commit.

SEE ALSO

git(1), parallel(1), xargs(1), find(1)

Copied to clipboard