Skip to content

Instantly share code, notes, and snippets.

@tmos
Created Dec 15, 2014
Embed
What would you like to do?
Update all git repos under the current folder
#! /bin/sh
clear
count=0
for i in *
do
if [ -d "$i" ]
then
cd "$i"
if [ -d ".git" ]
then
echo ""
echo "#####$i#####"
output=$(git pull)
echo $output
# listing of updated repos
if [ "$output" != "Already up-to-date." ]
then
count=$((count+1))
majs="$majs \n $i"
fi
fi
cd ..
fi
done
echo ""
echo ""
if [ $count -gt 0 ]
then
echo "$count repos updated :"
echo -e "$majs"
else
echo "No news here :("
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment