Get Started

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

  1. Query Parsing: Parses natural language questions to extract key search terms and time ranges.
  2. Git Log Search: Searches commit messages, file changes, and diff content for relevant information.
  3. Context Extraction: Extracts surrounding context from commits including related files, authors, and linked issues.
  4. 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

OptionDefaultDescription
searchDepth1000Maximum number of commits to search
includeIssueLinkstrueParse and follow links to issue trackers
diffContext3Lines of diff context to include in results
History Search | Memoria Features | Memoria