Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (17 sloc) 516 Bytes
#!/usr/bin/env python
import sys
import json
import re
import urllib
from subprocess import call
if len(sys.argv) < 2 or not sys.argv[1].startswith('https://github.com/'):
sys.stderr.write("Github URL is required\n")
sys.exit(1)
# Split the URL
url = sys.argv[1]
(fork, _, commit) = url.rsplit('/', 2)
(_, user, _) = url.rsplit('/', 2)
# fetch check out the branch
call("git remote add %s %s.git" % (user, fork), shell=True)
call("git fetch %s" % user, shell=True)
call("git co %s" % commit, shell=True)