Skip to content

Instantly share code, notes, and snippets.

@Und3rf10w
Created October 29, 2015 16:55
Show Gist options
  • Save Und3rf10w/7fbe4cac7a25d2d12f7f to your computer and use it in GitHub Desktop.
Save Und3rf10w/7fbe4cac7a25d2d12f7f to your computer and use it in GitHub Desktop.
Automatically updates all git repos within a directory. Great for manaing a large collection of tools installed in something like /opt
for repo in $(ls -l |grep dr |awk {'print $9'}); do
cd $repo;
if [ -d ".git" ]; then
echo "Attempting to update $repo"| logger
git pull;
if [ $? -ne 0 ]; then
echo "Error attempting to update $repo" 1> >(logger -s 2>> /opt/repoupdate.err)
fi;
fi;
cd ..;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment