Created
July 25, 2012 07:03
-
-
Save alghanmi/3174849 to your computer and use it in GitHub Desktop.
Recursively check status/pull/push Git Repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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