Skip to content

Instantly share code, notes, and snippets.

@cristiroma
Created March 12, 2014 09:13
Show Gist options
  • Save cristiroma/9503441 to your computer and use it in GitHub Desktop.
Save cristiroma/9503441 to your computer and use it in GitHub Desktop.
Bash shell script to handle multiple repositories in the same directory
#!/bin/bash
COMMAND=$1
if [ -z $1 ]; then
COMMAND="status"
else
COMMAND="$@"
fi
for repo in `find . -maxdepth 1 -mindepth 1 -type d`
do
if [ -d "$repo/.git" ]; then
cd $repo
echo -e "Processing `pwd` ... $COMMAND"
# pwd
git $COMMAND
cd ../
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment