Created
July 2, 2016 06:56
-
-
Save kg86/826b5c99125a064205d79009b1821cae to your computer and use it in GitHub Desktop.
git pull for all subdirectories
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
from __future__ import print_function | |
import os | |
import subprocess | |
def main(): | |
cmd = 'git pull' | |
dir = os.getcwd() | |
for subdir in os.listdir(dir): | |
if os.path.isdir(subdir) and os.path.exists(subdir): | |
print('chdir', subdir) | |
os.chdir(subdir) | |
subprocess.check_output(cmd, shell=True) | |
os.chdir(dir) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment