Multi-repo orchestration in one binary.
Runs a Git subcommand across many repositories listed in a multi-valued config key. It is multi-repo orchestration without a wrapper script - and it is what powers git maintenance schedules across all your clones.
Read paths from git config --get-all <name>, chdir into each, run git <command>... in turn. That's it. No parallelism, no fancy filtering - just a deterministic loop the maintenance scheduler can rely on.
git for-each-repo --config=<config> [--keep-going] [--] <command-args>| Flag | What it does |
|---|---|
--config=<config-name> | Required. Multi-valued config key whose values are repo paths to iterate (e.g. maintenance.repo). |
<command>... | The Git command (and its args) to run in each repo - everything after -- is forwarded verbatim. |
--keep-going | Continue iterating even if one repo's command exits non-zero (otherwise it stops at the first failure). |
--config with a single-valued key | ⚠️ Will error or behave surprisingly - the config key must be multi-valued. |
maintenance.repo with git maintenance run so cron or systemd ticks one binary.git fetch across all your work clones from a single command.git gc or git repack runs without a hand-rolled find | xargs.git for-each-repo --config=my.repos status -s to see who is dirty.git config --global --add maintenance.repo /path/to/repogit for-each-repo --config=maintenance.repo maintenance run --schedule=dailygit for-each-repo --config=my.repos -- fetch --all --prunegit for-each-repo --keep-going --config=my.repos -- gc --autogit maintenance register to populate maintenance.repo instead of editing config by hand - it also wires up the schedule.--keep-going for housekeeping commands; one corrupt repo shouldn't stop the rest from being maintained.-- before the forwarded command's args to avoid having for-each-repo eat flags it does not recognize.xargs -P or a real orchestrator when you need concurrency.~ expansion in older Git versions, and no glob support ever.Hit each option, then Check answers. Score is recorded; Next is always open.