Skip to content

Instantly share code, notes, and snippets.

@apetresc
Created August 7, 2013 01:51
Show Gist options
  • Select an option

  • Save apetresc/6170539 to your computer and use it in GitHub Desktop.

Select an option

Save apetresc/6170539 to your computer and use it in GitHub Desktop.
Script to grab all commits from an organization since a certain time
from github import Github
import datetime
USER = 'ENTER_USER_HERE'
PASS = 'ENTER_PASS_HERE'
ORG_NAME = 'ENTER_ORG_NAME_HERE'
SINCE = datetime.datetime(2012, 8, 1)
g = Github(USER, PASS)
org = [org for org in g.get_user().get_orgs() if org.name == ORG_NAME][0]
for repo in org.get_repos():
for commit in repo.get_commits(since=since):
print ('"%s","%s","%s","%s"' % (repo.name, commit.commit.author.date, commit.commit.author.name, commit.commit.message.replace('"', '\\"'))).encode('utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment