LinuxCommandLibrary

git-for-each-repo

Execute Git commands across multiple repositories

TLDR

Run command in each repo

$ git for-each-repo --config=[maintenance.repo] [command]
copy

SYNOPSIS

git for-each-repo --config=key command [args]

DESCRIPTION

git for-each-repo executes a specified Git command across multiple repositories defined in a Git configuration value. The command reads a multi-valued configuration key where each value is an absolute path to a Git repository, then runs the provided command in each one.
The primary use case is git-maintenance, which uses for-each-repo to run maintenance tasks like gc, fetch, or repack across all registered repositories on a schedule. Error handling continues execution across all repositories even if individual commands fail, ensuring that one failing repository does not prevent maintenance of others.

PARAMETERS

--config key

Config key listing repos.

CONFIGURATION

~/.gitconfig

Contains multi-valued configuration keys listing repository paths for batch operations.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community