Skip to content

drogers0/gitsleuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitSleuth

Find every line of code you've ever written -- across every repo you've touched.

GitSleuth is a developer forensics tool that searches your entire GitHub contribution history for code patterns. It automatically discovers repos where you've authored commits, PRs, or issues, plus repos you own, clones them locally, and searches through git diff history using regex and literal string matching. Whether you're tracking down that one-off utility you wrote three years ago or auditing your use of a specific API, GitSleuth has you covered.

Features

  • Automatic repo discovery -- finds GitHub repos where you've authored commits, PRs, or issues, plus repos you own
  • Deep diff search -- uses git log -G (regex) and -S (pickaxe) to search actual code changes, not just current file contents
  • Local repo support -- also searches repos on your local machine
  • Desktop GUI -- PySide6 interface with real-time streaming results, sortable/filterable table, and inline diff viewer
  • CLI mode -- full-featured command-line interface for scripting and automation
  • Smart cloning -- learns which protocol works (SSH vs HTTPS) and auto-switches; idempotent clone/update
  • Rate limit handling -- exponential backoff with jitter for GitHub API limits
  • Author & date filtering -- narrow results by contributor and time range

Requirements

Installation

# Clone the repo
git clone https://github.com/yourusername/gitsleuth.git
cd gitsleuth

# Install with uv
uv sync

# Or install with pip
pip install -e .

Quick Start

CLI

# Search for a regex pattern across all your contributed repos
gitsleuth -p 'osmosis|osmium|osm\.pbf' -a 'yourname'

# Search with date range
gitsleuth -p 'deprecated_function' -a 'yourname' --since '2023-01-01' --until '2024-01-01'

# Also search local repos
gitsleuth -p 'TODO|FIXME' -a 'yourname' --extra-local-dir ~/projects

# Prefer HTTPS cloning (useful if SSH is flaky)
gitsleuth -p 'TODO|FIXME' --https -a 'yourname'

# Use pickaxe for exact string matching
gitsleuth -p 'api_key' --pickaxe 'API_KEY_V2' -a 'yourname'

# Launch the GUI
gitsleuth --gui

GUI

# Launch directly
gitsleuth-gui

The GUI provides:

  • A search configuration panel with all CLI options
  • Real-time progress tracking as repos are discovered, cloned, and searched
  • A sortable, filterable results table
  • Click any result to view the full commit diff with syntax highlighting
  • Dark and light themes

CLI Reference

Usage:
  gitsleuth -p <regex> [OPTIONS]

Required:
  -p, --pattern        Regex pattern for git log -G

Optional:
  -w, --workspace      Directory to store cloned repos (default: auto-generated)
  -a, --author         git log --author filter
  -e, --email          Convenience: sets --author to this email
  --gh-user            GitHub login for repo discovery (default: authenticated user)
  --extra-local-dir    Additional local directory to search (repeatable)
  --https              Prefer HTTPS for cloning (auto-learns which protocol works)
  --pickaxe            Literal string search via git log -S
  --max                Max commits per repo per search mode (default: 20)
  --since              Date filter: git log --since
  --until              Date filter: git log --until
  --no-update          Skip fetch/pull; only search existing clones
  --repos-file         Use an existing repos list file instead of GitHub API
  --gui                Launch the GUI instead of CLI

How It Works

  1. Discover -- queries the GitHub API to find repos where you've authored commits, PRs, or issues, plus repos you own
  2. Clone/Update -- idempotently clones missing repos and fetches updates for existing ones
  3. Search -- runs git log --all -G <regex> across every branch and tag in each repo, extracting matching diff snippets
  4. Report -- streams results as they're found, with commit hash, date, subject, and the matching line of code

Example Output

source   repo                                        sha        date        subject                                       match
------   ----                                        ---        ----        -------                                       -----
remote   yourorg/data-pipeline                       a1b2c3d    2024-03-15  Add PBF file processing                       +from osmium import SimpleHandler
remote   yourorg/geo-tools                           e4f5g6h    2023-11-02  Refactor extract pipeline                     +osmium extract input.osm.pbf
local    personal/map-scripts                        i7j8k9l    2023-06-20  Initial commit                                +osm_data = read_pbf(path)

License

MIT

About

Find every line of code you've ever written -- across every repo you've touched.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors