Last active
August 29, 2015 14:06
-
-
Save faloi/bbc27a4a5e40828e94be to your computer and use it in GitHub Desktop.
Scans all Git repositories at the given path and outputs those who have uncommited changes
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 | |
# Update all git directories below current directory or specified directory, asking for confirmation | |
function ask_yes_or_no() { | |
read -p "$1 ([y]es or [N]o): " | |
case $(echo $REPLY | tr '[A-Z]' '[a-z]') in | |
y|yes) echo "yes" ;; | |
*) echo "no" ;; | |
esac | |
} | |
HIGHLIGHT="\e[01;34m" | |
NORMAL='\e[00m' | |
DIR=. | |
if [ "$1" != "" ]; then DIR=$1; fi | |
cd $DIR>/dev/null; echo -e "${HIGHLIGHT}Scanning ${PWD}${NORMAL}"; | |
for d in `find . -name .git -type d -prune`; do | |
cd $d/.. > /dev/null | |
status=$(git status -s) | |
echo -e "\n${HIGHLIGHT}`pwd`$NORMAL" | |
if [[ $(ask_yes_or_no "Push?") != "no" ]]; then | |
git push | |
fi | |
cd - > /dev/null | |
done |
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 | |
# Scans all Git repositories at the given path and outputs those who have uncommited changes | |
HIGHLIGHT="\e[01;34m" | |
NORMAL='\e[00m' | |
DIR=. | |
if [ "$1" != "" ]; then DIR=$1; fi | |
cd $DIR>/dev/null; echo -e "${HIGHLIGHT}Scanning ${PWD}${NORMAL}"; | |
for d in `find . -name .git -type d -prune`; do | |
cd $d/.. > /dev/null | |
status=$(git status -s) | |
if [[ -n $status ]]; then | |
echo -e "\n${HIGHLIGHT}`pwd`$NORMAL" | |
echo "$status" | |
fi | |
cd - > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment