GitHunt
DA

david4096/commit-tracker

Track commits across an org

Commit Tracker

A Python script to fetch and export GitHub commits for a specific user across an organization.

Features

  • Fetch all commits for a user in a GitHub organization
  • Support for date range filtering
  • Multiple output formats: CSV (default), JSON, simple text, and detailed text
  • Automatic pagination handling (up to GitHub's 1000 result limit)
  • Rate limit monitoring
  • Progress tracking with verbose mode

Requirements

  • Python 3.6+
  • requests library

Installation

  1. Clone this repository:
git clone git@github.com:david4096/commit-tracker.git
cd commit-tracker
  1. Install dependencies:
pip install requests

Usage

Basic Usage

./fetch_commits.py <org-name> <username> --token <your-github-token>

Examples

Export to CSV (default):

./fetch_commits.py {ORGANIZATION} {USER} \
  --token YOUR_GITHUB_TOKEN \
  --start-date 2023-01-01 \
  --end-date 2025-12-09 > commits.csv

With date range and verbose output:

./fetch_commits.py {ORGANIZATION} {USER} \
  --token YOUR_GITHUB_TOKEN \
  --start-date 2024-01-01 \
  --end-date 2024-12-31 \
  --verbose > commits.csv

JSON output:

./fetch_commits.py {ORGANIZATION} {USER} \
  --token YOUR_GITHUB_TOKEN \
  --format json > commits.json

Simple text format:

./fetch_commits.py {ORGANIZATION} {USER} \
  --token YOUR_GITHUB_TOKEN \
  --format simple

Detailed text format:

./fetch_commits.py {ORGANIZATION} {USER} \
  --token YOUR_GITHUB_TOKEN \
  --format detailed

Command Line Arguments

  • org - GitHub organization name (required)
  • username - GitHub username to search for (required)
  • --token - GitHub personal access token (required)
  • --start-date - Start date in YYYY-MM-DD format (optional)
  • --end-date - End date in YYYY-MM-DD format (optional)
  • --format - Output format: csv, json, simple, or detailed (default: csv)
  • --verbose, -v - Enable verbose output with progress information

GitHub Token Setup

  1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Click "Generate new token (classic)"
  3. Give it a descriptive name (e.g., "Commit Tracker")
  4. Select scopes:
    • For public repositories: public_repo
    • For private repositories: repo (full control)
  5. Generate and copy the token
  6. Use it with the --token parameter

Important: Never commit your token to version control. Always pass it as a command-line argument or use environment variables.

Output Formats

CSV (Spreadsheet)

Comma-separated values with columns:

  • Date
  • SHA (short)
  • Repository
  • Author
  • Message (first line)
  • URL

Perfect for opening in Excel, Google Sheets, or other spreadsheet applications.

JSON

Full GitHub API response data for each commit. Useful for further processing or analysis.

Simple Text

One line per commit with date, SHA, repository, and message.

Detailed Text

Multi-line format with commit details and clickable URLs.

Limitations

  • GitHub's search API has a maximum limit of 1000 results per query
  • If you hit this limit, the script will warn you to narrow your date range
  • Rate limits apply based on your GitHub token's permissions

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

david4096/commit-tracker | GitHunt