Skip to content

Instantly share code, notes, and snippets.

@sbp
Created December 20, 2011 17:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbp/1502325 to your computer and use it in GitHub Desktop.
Save sbp/1502325 to your computer and use it in GitHub Desktop.
Mirror a user's gists
#!/bin/sh
GIST_USER=sbp
if [ "$1" = "update" ]
then
curl -s http://gist.github.com/api/v1/json/gists/$GIST_USER |
python -c 'import sys, json
for gist in json.loads(sys.stdin.read())["gists"]:
print gist["repo"]' | while read GIST
do if [ ! -d $GIST ]
then git submodule add git://gist.github.com/$GIST.git
echo Created $GIST submodule
fi
done
elif [ "$1" = "sync" ]
then
git submodule foreach git pull
else
echo Options:
echo update - Gets any new gists for user
echo sync - Keep existing gists synced with server
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment