#!/bin/bash
# Execute git command in all subdirectories

set -e

cmd=$*

YELLOW='\033[0;33m'
NC='\033[0m' # No Color
for repo in $(find . -maxdepth 2 -name .git -type d); do
    repodir=$(dirname $repo)
    pushd $repodir > /dev/null
    printf "\ncd ${YELLOW}${repodir}${NC} && git $cmd\n"
    git $cmd
    popd > /dev/null
done
