Skip to content

Instantly share code, notes, and snippets.

@pvdb
Last active January 30, 2025 21:11
Show Gist options
  • Save pvdb/027b0dbe58b49b05d154604750b50c7d to your computer and use it in GitHub Desktop.
Save pvdb/027b0dbe58b49b05d154604750b50c7d to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# INSTALLATION
#
# ln -s ${PWD}/git-recurse $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-recurse /usr/local/bin/
#
(
find . -mindepth 2 -maxdepth 2 -type d -name '.git' ; # ${REPO}/.git
find . -mindepth 3 -maxdepth 3 -type d -name '.git' ; # ${OWNER}/${REPO}/.git
find . -mindepth 4 -maxdepth 4 -type d -name '.git' ; # ${PACKAGE}/opt/${REPO}/.git
find . -mindepth 4 -maxdepth 4 -type d -name '.git' ; # ${PACKAGE}/start/${REPO}/.git
) | while read -r git_dir ; do
git_path=$(dirname "${git_dir}") ;
>&2 printf "\033[7m$ git -C %s %s\033[0m\n" "${git_path}" "$*" ;
git -C "${git_path}" "$@" ;
done
# That's all Folks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment