Skip to content

Instantly share code, notes, and snippets.

@alghanmi
Created July 25, 2012 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alghanmi/3174849 to your computer and use it in GitHub Desktop.
Save alghanmi/3174849 to your computer and use it in GitHub Desktop.
Recursively check status/pull/push Git Repositories
#!/bin/bash
REPO_LIST=$(find . -maxdepth 1 -type d | grep -v ^\.$ | cut -d/ -f2)
function action_prompt() {
is_done=0
while [ $is_done == 0 ]; do
read -p "Would you like to: (s)tatus, (p)ull, p(u)sh, (n)ext? (s/p/u/n)?" answer
case $answer in
"S" | "s" )
echo "git status"
echo -e -n '\e[00;31m'
git status
echo -e -n '\e[00m'
;;
"P" | "p" )
echo "git pull"
git pull
;;
"U" | "u" )
echo "git push"
git push
;;
"N" | "n" )
is_done=1
;;
* )
echo "invalid option '$answer'."
esac
done;
}
for r in $REPO_LIST
do
echo ""
echo -e "*** Checking \e[01;34m$r\e[00m"
cd $r
action_prompt
cd ..
echo -e -n "\n"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment