Skip to content

Instantly share code, notes, and snippets.

@eralpkaraduman
Created September 11, 2015 10:45
Show Gist options
  • Save eralpkaraduman/66e7b6e89c5f7476ae60 to your computer and use it in GitHub Desktop.
Save eralpkaraduman/66e7b6e89c5f7476ae60 to your computer and use it in GitHub Desktop.
dumps commit messages with dates in last week to a file with week number
import subprocess
from datetime import datetime
process = subprocess.Popen([
"git",
"log",
"--after", "1 week ago",
"--author", "eralpkaraduman",
"--format=%cd%n%s%n",
"--reverse",
"--date=short"
], stdout=subprocess.PIPE, cwd='/Users/eralp/ios-dumb-app')
output = process.communicate()[0]
today = datetime.today()
week_num = today.strftime("%U")
file_name = "commits_week_"+week_num+".txt"
log_file = open(file_name,"w")
log_file.write(output)
log_file.close()
print "ok, see "+file_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment