Skip to content

Instantly share code, notes, and snippets.

@nfarring
Created October 28, 2010 19:57
Show Gist options
  • Save nfarring/652206 to your computer and use it in GitHub Desktop.
Save nfarring/652206 to your computer and use it in GitHub Desktop.
Iterates through all of the git repos in the current directory and performs some git operation. The default is 'git status'.
#!/usr/bin/env bash
GITCMD=status
if [[ -n $1 ]]; then
GITCMD=$1
fi
echo
for dir in `ls`; do
(if [[ -d "$dir" && -d "$dir/.git" ]]; then
cd $dir
echo $dir
git "$GITCMD"
cd ..
echo
fi)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment