Skip to content

Instantly share code, notes, and snippets.

@marz619
Last active November 4, 2015 02:49
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 marz619/8f292ad26cc4bfd157f8 to your computer and use it in GitHub Desktop.
Save marz619/8f292ad26cc4bfd157f8 to your computer and use it in GitHub Desktop.
Scripts for refreshing git projects
#!/bin bash
# single depth folder
for d in `ls -d *(^@)`; do
echo $d
cd $d
branch=`git rev-parse --abbrev-ref HEAD`
echo "branch=$branch"
if [ "$branch" = "master" ]; then
echo "$d - master"
git pull origin && git remote prune origin
else
echo "$d - not master"
fi
cd ..
done
# double depth folder
for d in `ls -d *(^@)`; do
echo $d
cd $d
for ds in `ls -d *(^@)`; do
echo "\t$ds"
cd $ds
branch=`git rev-parse --abbrev-ref HEAD`
echo "branch=$branch"
if [ "$branch" = "master" ]; then
echo "$d - $ds - master"
git pull origin && git remote prune origin
else
echo "$d - $ds - not master"
fi
cd ..
done
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment