Last active
December 21, 2015 00:18
-
-
Save Darklg/6218696 to your computer and use it in GitHub Desktop.
Pull all your git repositories in a single command
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 | |
function pullall { | |
# Go to folder | |
cd $1; | |
# Check if it's a git repository | |
if test -d ".git/"; then | |
# Display repository name | |
echo -e "\033[33m "$1" \033[0m"; | |
# Check repository status | |
status=`git status -s`; | |
# Git says nothing | |
if [ -z "$status" ] | |
then | |
# Pull latest changes | |
echo "- Pull"; | |
git pull --rebase; | |
else | |
git fetch origin; | |
# Do nothing | |
echo "- Papull"; | |
fi | |
fi | |
} | |
dirhtd=/Users/kevin/Websites/htdocs/git/* | |
for f in $dirhtd | |
do | |
pullall $f; | |
done | |
dirhtd=/Users/kevin/Websites/htdocs/ae/* | |
for f in $dirhtd | |
do | |
pullall $f; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment