#!/usr/bin/env bash # # Recursively search for git repos and run `git pull` on them. # set -eu -o pipefail if [[ $# -eq 0 ]]; then search_root=. else search_root="$1" fi find "$search_root" -name .git -print0 | while read -r -d $'\0' git_dir; do repo="${git_dir%/*}" tput setaf 2 printf '>> Updating %s ...\n' "$repo" tput sgr0 pushd "$repo" >/dev/null git pull popd >/dev/null done