Protip: Finding all of your Git repositories.

09 September 2012

How to find all of the Git repositories in the current working directory:

find . -maxdepth 2 -type d -name '.git' -print | awk -F/ '{print $2}'

How to update all of them in one shot:

for i in find . -maxdepth 2 -type d -name '.git' -print | awk -F/ '{print $2}'; do
echo "Updating repository $i."
cd $i
git pull
cd ..
echo "Done."
done