Execute git command on multiple repos
Save this script in folder where you keep your repos as git_all_repos
, make executable and enjoy.
Usage: git_all_repos pull
#!/bin/bash
shift $(($OPTIND - 1))
# Replace manually specified repos with this to run script on all directories
#
#PWD=`pwd`
#DIRS=`ls -l $PWD | egrep '^d' | awk '{print $9}'`
# Specify on which repos run script
#
declare -a DIRS=(admin-portal admin-portal-api client-manager client-manager-api commons product-ingest product-ingest-api product-ingest-worker product-manager search-client search-manager search-manager-api store-presentation)
for DIR in ${DIRS[@]}
do
#Execute command
#
OUT=`cd $DIR && git ${*}`
#Pretty print
#
echo -e ""
echo -e "executing in: $DIR"
echo $OUT
echo "-------------------------------"
done
Written by Michał Pasierbski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#