On Unix-es use a function to wrap git
Usage: ogit "path/to/repo/" [git options & sub commands]
ogit() {
_PATH=$1
shift
GIT_WORK_TREE="${_PATH%/.git}" GIT_DIR="${_PATH%/.git}"/.git git "$@"
}
ogit path/to/repo status --short
Usage: ogit-group paths... -- [git options and sub commands]
ogit-group() {
OGIT_PATHS_COMPLETED=0
OGIT_PATHS=()
for opt in "$@"; do
[[ "--" == "$opt" ]] && OGIT_PATHS_COMPLETED=1 && shift
[[ $OGIT_PATHS_COMPLETED == 1 ]] && break || OGIT_PATHS+=("$opt") && shift
done
for p in "$OGIT_PATHS[@]"; do
echo "${p} --- git $@"
ogit "$p" "$@"
done
}
ogit-group path/to/repo another/repo yet-another/repo -- status --short
or with globbing
ogit-group glob/path/repos* -- status --short