Skip to content

Instantly share code, notes, and snippets.

@tranma
Last active August 29, 2015 14:06
Show Gist options
  • Save tranma/3f1943b44d4c391f05c0 to your computer and use it in GitHub Desktop.
Save tranma/3f1943b44d4c391f05c0 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEV_DIR=$1
REPOS=("package1" "package2")
RED='\033[1;33m'
BLUE='\033[1;31m'
NC='\033[0m'
if [[ -z $DEV_DIR ]]
then
DEV_DIR=$(pwd)
fi
echo "Looking in $DEV_DIR for repos"
for thing in $DEV_DIR/* ;
do
if [[ -d $thing ]]
then
name=$(basename $thing)
if [[ " ${REPOS[*]} " == *" $name"* ]];
then
cd $thing
branch=$(git rev-parse --abbrev-ref HEAD)
echo -e "Updating branch ${RED}$branch${NC} of ${BLUE}$thing${NC}..."
git pull origin $branch
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment