Skip to content

Instantly share code, notes, and snippets.

@tmos
Created December 15, 2014 20:43
Show Gist options
  • Save tmos/5ec08aae48ce6fa05105 to your computer and use it in GitHub Desktop.
Save tmos/5ec08aae48ce6fa05105 to your computer and use it in GitHub Desktop.
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