Este script de shell puxará todos os repositórios Git em uma pasta específica.
#!/bin/bash
dirhtd=/Users/kevin/websites/htdocs/*
for f in $dirhtd
do
# Go to folder
cd $f;
# Check if it's a git repository
if test -d ".git/"; then
# Display repository name
echo -e " 33[33m "$f" 33[0m";
# Check repository status
status=`git status -s`;
# Git says nothing
if [ -z "$status" ]
then
# Pull latest changes
echo "- Pull";
git pull --rebase;
else
# Do nothing
echo "- Can’t pull";
fi
fi
done