GIT-FOR-EACH-REPO(1)
π git-for-each-repo(1) β the Git Manual, bestie edition π
okay so picture this: you've got a whole lil squad of repos and you need to run the same Git command on every single one of them. that's the entire plot of git-for-each-repo. it's a Git manual page, and honestly? it's giving personal assistant energy. π¦
β¨ NAME β¨
git-for-each-repo β run a Git command on a list of repositories π
πΈ SYNOPSIS πΈ
git for-each-repo --config=<config> [--] <arguments>
that's it. that's the whole vibe check. π«Ά
π DESCRIPTION π
so basically: this runs a Git command on a list of repositories. iconic, right? the arguments that come after the known options β or after the -- indicator β get used as the arguments for the Git subprocess. lowkey elegant. β¨
β οΈ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE. β like, fr fr, it's still cooking. don't build your whole personality around it staying identical forever. π
okay, example time, because examples ate and left no crumbs:
say you've got a bunch of repos stored in a maintenance.repo config variable and you wanna run maintenance on every one of them. you'd do:
git for-each-repo --config=maintenance.repo maintenance run
and what that does is run git -C <repo> maintenance run for each value <repo> in that multi-valued config variable maintenance.repo. not me crying over how clean that is π
π OPTIONS π
--config=<config>β use the given config variable as a multi-valued list that stores absolute path names. then it iterates over that list of paths and runs the arguments you gave it. ποΈ
these config values are loaded from system, global, and local Git config, as available. important caveat bestie: if git for-each-repo is run in a directory that is not a Git repository, then only the system and global config is used. no local for you. π
--keep-goingβ keeps going with the remaining repositories even if the command failed on one of them. the resilient main character option. πͺ
the exit code will still indicate that the overall operation was not successful, though. it's not gonna pretend everything's fine. π«
β οΈ note that the exact exit code of the failing command is not passed through as the exit code of thefor-each-repocommand: if the command failed in any of the specified repositories, the overall exit code will be1. so likeβ¦ a failure is a1, no matter which flavour of failure it was. periodt. π
π₯ SUBPROCESS BEHAVIOR π₯
if any git -C <repo> <arguments> subprocess returns a non-zero exit code, then the git for-each-repo process returns that exit code β without running any more subprocesses. it stops dead. no cap. π
each git -C <repo> <arguments> subprocess inherits the standard file descriptors stdin, stdout, and stderr. so your input and output flow through like the gorgeous little pipeline it is. β
π GIT π
part of the git(1) suite. one big happy family. ππ§
kay that's the whole page, you're officially a for-each-repo girlie now π
this masterpiece was brought to you by Git 2.56.0, dated 2026-09-27 β mwah, go run some commands on all your repos at once, you absolute icon ππ
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms