Last active
November 4, 2015 02:49
-
-
Save marz619/8f292ad26cc4bfd157f8 to your computer and use it in GitHub Desktop.
Scripts for refreshing git projects
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 | |
# 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