Created
May 25, 2009 21:43
-
-
Save tonyg/117767 to your computer and use it in GitHub Desktop.
Keep a set of clones of your github repos up-to-date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Keep a set of clones of your github repos up-to-date. Run this in a | |
# directory of its own. It will clone (or update) your github repos into | |
# subdirectories, one per repo. Written on OS X Leopard. | |
# Depends on /usr/bin/xpath. | |
# Make sure you set githubuser, below, to the correct value :-) | |
githubuser=tonyg | |
for repo in $(curl http://github.com/api/v1/xml/$githubuser | xpath '//repository/name' 2>/dev/null | sed -e 's:><:> <:g') | |
do | |
repo=$(echo $repo | sed -e 's:<name>::' -e 's:</name>::') | |
echo $repo ... | |
if [ -d $repo ] | |
then | |
(cd $repo; git pull) | |
else | |
git clone git://github.com/$githubuser/$repo.git | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment