Skip to content

Instantly share code, notes, and snippets.

@pvdb
Last active February 12, 2024 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 . -type d -name '.git' -depth 2 -path '*/.git' ; # ${REPO}/.git
find . -type d -name '.git' -depth 3 -path '*/*/.git' ; # ${OWNER}/${REPO}/.git
find . -type d -name '.git' -depth 4 -path '*/opt/*/.git' ; # ${PACKAGE}/opt/${REPO}/.git
find . -type d -name '.git' -depth 4 -path '*/start/*/.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