Skip to content

Instantly share code, notes, and snippets.

@chand1012
Last active August 8, 2017 16:27
Show Gist options
  • Save chand1012/3b8474dac8b51038ec08f4850cf5bc36 to your computer and use it in GitHub Desktop.
Save chand1012/3b8474dac8b51038ec08f4850cf5bc36 to your computer and use it in GitHub Desktop.
Python Git repo auto updater
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