git-bulk
Run Git commands across multiple repositories
TLDR
Register the current directory as a workspace
Register a workspace for bulk operations
Clone a repository inside a specific directory, then register the repository as a workspace
Clone repositories from a newline-separated list of remote locations, then register them as workspaces
List all registered workspaces
Run a Git command on the repositories of the current workspace
Remove a specific workspace
Remove all workspaces
SYNOPSIS
git-bulk [options] command...
git-bulk [options] -p
git-bulk [options] --help
PARAMETERS
-d <directory>, --directory <directory>
Specifies the root directory to search for Git repositories. Defaults to the current working directory if not provided.
-r <pattern>, --repos <pattern>
A regular expression pattern to match repository names (directory names) to include in the operation. Only repositories whose names match this pattern will be processed.
-x <pattern>, --exclude <pattern>
A regular expression pattern to match repository names (directory names) to exclude from the operation. Repositories matching this pattern will be skipped.
-j <jobs>, --jobs <jobs>
The number of parallel jobs to run commands across repositories. A value of 0 (zero) will attempt to use all available CPU cores, providing maximum parallelism.
-s, --no-status
Suppresses the initial git status check that git-bulk performs on each repository before executing the specified command. This can speed up operations on very large numbers of repositories.
-i, --interactive
Enables interactive mode. For each found repository, the user will be prompted to confirm whether the command should be run, allowing granular control over execution.
-v, --verbose
Increases the verbosity of the output, providing more detailed information about the scanning process, command execution, and results for each repository.
-q, --quiet
Suppresses most output, showing only errors or critical information. This is useful for scripting where minimal output is desired.
-p, --path-only
Only prints the absolute paths of the Git repositories found, without executing any command. This mode is useful for generating lists of repositories that can be piped to other commands.
--no-colors
Disables colored output in the terminal, which can be useful in environments that do not support ANSI escape codes or for logging purposes.
--help
Displays the help message, including usage instructions and a list of all available options, and then exits.
command...
The Git command (e.g., pull, status) or any arbitrary shell command and its arguments that will be executed for each found Git repository. git-bulk changes directory into each repository before running this command.
DESCRIPTION
git-bulk is a command-line utility designed to streamline operations across a collection of Git repositories. Instead of manually navigating into each repository and executing a Git command, git-bulk automates this process. It scans a specified root directory for Git repositories and allows users to run any arbitrary Git command, or even a shell command, against each found repository. This tool is particularly useful for managing monorepos or projects with numerous loosely coupled repositories, facilitating tasks like pulling updates, checking statuses, or pushing changes in bulk. Its options allow for parallel execution, filtering repositories by name, and controlling output verbosity.
CAVEATS
git-bulk is not a native Git command but a standalone utility that requires separate installation. Its functionality relies on discovering Git repositories based on the presence of a .git sub-directory; non-standard repository structures might not be detected. Running arbitrary shell commands carries security considerations, especially with untrusted inputs. Users should carefully review output as error handling for individual repository commands can vary. Performance scales with the number of repositories, command complexity, and parallelism settings.
INSTALLATION
git-bulk is typically installed as a standalone script. One common method involves downloading it directly (e.g., using curl) or via package managers (if available for your system). It is crucial to ensure the script is executable and placed in a directory listed in your system's PATH environment variable for direct command-line access.
REPOSITORY DISCOVERY
git-bulk identifies Git repositories by searching for directories that contain a .git sub-directory. This standard detection method ensures compatibility with most common repository setups. It efficiently traverses the directory tree from the specified root (using the -d option) to locate all eligible repositories before executing commands.
HISTORY
While the general concept of bulk Git operations existed in various custom scripts, the johnste/git-bulk implementation emerged as a popular, user-friendly, and well-maintained tool. It gained traction by simplifying common multi-repository workflows, offering features like parallel execution and flexible repository filtering, addressing a need not natively covered by Git itself.
SEE ALSO
git(1), find(1), xargs(1), git-submodule(1), git-worktree(1), repo(1)