Skip to content

Instantly share code, notes, and snippets.

@eLBati
Created January 29, 2016 10:12
Show Gist options
  • Save eLBati/3f9b2bac76de78bb417d to your computer and use it in GitHub Desktop.
Save eLBati/3f9b2bac76de78bb417d to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import os
from datetime import datetime
now = datetime.now
dirlist = [d for d in os.listdir('.') if os.path.isdir(os.path.join('.', d))]
current_path = os.getcwd()
now_date = datetime.now().date()
if now_date.month == 1:
last_month = datetime(now_date.year-1, 12, now_date.day)
else:
last_month = datetime(now_date.year, now_date.month-1, now_date.day)
for directory in dirlist:
fullpath = '%s/%s' % (current_path, directory)
print "going into %s" % fullpath
os.chdir(fullpath)
os.system('git fetch origin')
os.system('git checkout origin/8.0')
os.system('echo "--- %s" >> ../output.txt' % directory)
os.system(
'git log --oneline --after="%s-%s-%s" >> ../output.txt'
% (last_month.year, last_month.month, last_month.day))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment