← 返回命令列表

Linux command

git-for-each-repo 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run a git command in each repo listed in a config key

git for-each-repo --config=[maintenance.repo] [fetch]

Run maintenance on all registered repos

git for-each-repo --config=[maintenance.repo] maintenance run

Continue on failure

git for-each-repo --config=[maintenance.repo] --keep-going [gc]

说明

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. Config values are loaded from system, global, and local Git config. If run outside a Git repository, only system and global config is used.

参数

--config _key_
Multi-valued config key listing absolute paths to repositories.
--keep-going
Continue with remaining repositories if the command fails on one. The exit code still indicates failure.

FAQ

What is the git-for-each-repo command used for?

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. Config values are loaded from system, global, and local Git config. If run outside a Git repository, only system and global config is used.

How do I run a basic git-for-each-repo example?

Run `git for-each-repo --config=[maintenance.repo] [fetch]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --config _key_ do in git-for-each-repo?

Multi-valued config key listing absolute paths to repositories.