-
-
Save eddy-22/fa6a0dbc5d884b5fd0c9b04bb8010c67 to your computer and use it in GitHub Desktop.
Download a specific folder from a github repo
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
#!/usr/bin/python | |
""" | |
Download a specific folder from a github repo: | |
gitget.py https://github.com/divs1210/kilvish/tree/master/examples/bricksnball | |
""" | |
__author__ = 'Divyansh Prakash' | |
import sys | |
import subprocess | |
if __name__ == '__main__': | |
if len(sys.argv) > 1: | |
github_src = sys.argv[1] | |
try: | |
head, branch_etc = github_src.split('/tree/') | |
folder_url = '/'.join(branch_etc.split('/')[1:]) | |
except: | |
print 'err:\tnot a valid folder url!' | |
else: | |
print 'fetching...' | |
subprocess.call(['svn', 'checkout', '/'.join([head, 'trunk', folder_url])]) | |
else: | |
print 'use:\tgitget.py https://github.com/user/project/tree/branch-name/folder\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment