Created
November 1, 2018 16:16
-
-
Save aglove2189/2bb964b929fb1f969e2a67ed2c89b7d7 to your computer and use it in GitHub Desktop.
Bulk clone and/or pull a list of repos
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
# -*- coding: utf-8 -*- | |
import os | |
import re | |
pat = '\w*(?=\.git$)' | |
with open('git.sh', mode='w') as f: | |
f.write('#!/usr/bin/env bash\n') | |
for repo in repos: | |
repo_folder = re.search(pat, repo).group() | |
if os.path.exists(repo_folder): | |
cmd = 'cd {} && git pull origin master\n'.format(repo_folder) | |
f.write(cmd) | |
f.write('cd ..\n') | |
else: | |
cmd = 'git clone {}\n'.format(repo) | |
f.write(cmd) |
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/env bash | |
python git.py && ./git.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment