Skip to content

Instantly share code, notes, and snippets.

@Darklg
Last active December 21, 2015 00:18
Show Gist options
  • Save Darklg/6218696 to your computer and use it in GitHub Desktop.
Save Darklg/6218696 to your computer and use it in GitHub Desktop.
Pull all your git repositories in a single command
#!/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