Last active
August 8, 2017 16:27
-
-
Save chand1012/3b8474dac8b51038ec08f4850cf5bc36 to your computer and use it in GitHub Desktop.
Python Git repo auto updater
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
import os, sys | |
from easygui import * | |
title = "Git Auto Update" | |
msg = "Do you want to update your Git Repos?" | |
if not ynbox(title, msg): | |
sys.exit() | |
print('Getting list of directories...') | |
projects = os.listdir() | |
print('Done!') | |
for project in projects: | |
if 'nonGit' in project: | |
continue | |
print("Changing dir to {}".format(project)) | |
try: | |
os.chdir(project) | |
except: | |
print("Is file not directory! Skipping.") | |
continue | |
print("Checking for changes...") | |
os.system('git pull origin master') | |
print('Changing back to starting directory.') | |
os.chdir('..') | |
print('Done') | |
msgbox('All repos updated!', 'Git Auto Update') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment