git‐all - yktoo/yktools GitHub Wiki
Traverses all your Git repositories and runs the same git
command against them.
It can run in two modes:
- Running
git-all <command> <args...>
will search Git repositories (i.e. directories having.git
subdirectory right under them) starting from your code root (see theCODE_ROOT_DIR
at the beginning of the script).
This mode ignores all directories whose name starts with an underscore (_
) and everything below them.
Useful for skipping updates to things you don’t manage, like sources you’ve temporarily checked out, or projects specific to some environment. - Giving a
.
as the first argument:git-all . <command> <args...>
will search Git repositories starting from the current directory, whatever it may be. In this mode no directory is ignored, so it can be used to bypass the limitations of the previous mode.
git-all [.] command [arg1 [arg2...]]
Where:
-
.
a dot as the first argument tells the script to start traversing the directory tree starting from the current location, as well as not to ignore ones whose name starts with an underscore. -
command
Command to pass togit
-
arg1...argN
Any additional arguments to be passed togit
# Show status of all repositories
git-all status
# Show short status
git-all status -s
# Pull from all default remotes
git-all pull
# Prune all orphaned remote branches
git-all remote prune origin
# Rename all remotes
git-all remote rename origin github
- This blog post for more background and examples.
- Script source code on GitHub.