History Search
Search git history for context
History Search lets you query git history to understand WHY code was written. Solves the Chesterton's Fence problem - never delete code without understanding why it was added.
Overview
History Search provides natural language queries against your git history. Ask questions like 'why was this function added?' or 'what bug did this fix?' and get relevant commits with their context. This solves Chesterton's Fence - the principle that you should understand why something exists before removing it.
How It Works
- Query Parsing: Parses natural language questions to extract key search terms and time ranges.
- Git Log Search: Searches commit messages, file changes, and diff content for relevant information.
- Context Extraction: Extracts surrounding context from commits including related files, authors, and linked issues.
- Result Ranking: Ranks results by relevance using text matching and temporal proximity to the code in question.
Technical Details
Combines `git log -S` (pickaxe) for content search, `git log --grep` for message search, and `git blame` for line-level attribution. Supports searching linked issue trackers (GitHub, Jira) when commit messages contain references.
Use Cases
Understanding Legacy Code
Before modifying old code, understand the context and constraints that shaped it.
Bug Archaeology
Trace the history of a bug to understand why previous fixes didn't work.
Knowledge Transfer
Help new team members understand the reasoning behind architectural decisions.
Configuration Options
| Option | Default | Description |
|---|---|---|
searchDepth | 1000 | Maximum number of commits to search |
includeIssueLinks | true | Parse and follow links to issue trackers |
diffContext | 3 | Lines of diff context to include in results |