# Revision history [back]

Hi, I'm not sure if what I've been doing is right, but the following is a piece of code I use to refresh the master branch of every single repo under /opt/stack when I need to:


#!/usr/bin/env python
from os import listdir,chdir
from os.path import isdir,join
from subprocess import call
mypath='/opt/stack/'
onlydirs=[d for d in listdir(mypath) if isdir(join(mypath,d))]
for d in onlydirs:
print "="*70
print "Updating %s..." % join(mypath,d)
chdir(join(mypath,d))
call(["git","checkout","master"])
call(["git","remote","update"])
call(["git","pull","--ff-only","origin","master"])


Hope this helps and if there is a better way to do so please feel free to share. Thanks!