| name | git-context |
| description | Search git history for context — commit messages, blame, related changes, impact analysis |
| license | MIT |
| compatibility | cline, claude, opencode, amp, codex, gemini, cursor, pi |
| hint | Use to understand why code was written a certain way or find related changes |
| user-invocable | true |
Git Context
When to Use
Use this skill when:
- Understanding why code was written a certain way
- Finding related changes across the codebase
- Tracing the evolution of a feature or pattern
- Identifying who has expertise in a module
- Finding past bug fixes or regressions in an area
What It Does
Searches git history to build context about the codebase, using a combination of native git commands and the sem MCP tool for deeper analysis. Helps answer "why was this done this way?" and "what changed recently in this area?"
How to Execute
Find Recent Changes to a Module
git log --oneline --all -20 -- path/to/module/
git shortlog -sn -- path/to/module/
git log -S "functionName" --oneline -- path/to/module/
Trace a Function's History
git log -S "export function calculateTotal" --oneline
git blame path/to/file.ts -L 10,30
git show <commit-hash> --no-patch
Find Related Changes
git log --all --name-only -- path/to/changed/file.ts | head -20
git log --all --grep="fix|bug|hotfix" --oneline -20
Using sem for Deeper Analysis
sem blame path/to/file.ts --function processOrder
sem impact path/to/file.ts --function processOrder
sem diff main..HEAD -- path/to/file.ts
Cross-Session Context
ctx search "this module" path/to/module/
ctx search "bug fix" path/to/module/
Decision Tree
┌────────────────────────────┬────────────────────────┐
│ Need this │ Use this │
├────────────────────────────┼────────────────────────┤
│ What changed recently │ git log -20 -- path/ │
│ Who works on this module │ git shortlog -sn path/ │
│ Why was this line added │ git blame path/to/file │
│ When was function added │ git log -S "funcName" │
│ What else changed together │ git log --name-only │
│ Impact of changing X │ sem impact path/func │
│ Past agent work on this │ ctx search "topic" │
└────────────────────────────┴────────────────────────┘
Common Patterns
Pre-Implementation Check
Before implementing a change, check:
git log --oneline --all -10 -- src/feature/
git shortlog -sn -- src/feature/ | head -5
git log --all --grep="feature-name" --oneline
git log --all --grep="bug|fix|error" --oneline -10 -- src/feature/
Post-Change Verification
After implementing, verify:
git diff --stat
git diff --cached --name-only
git diff HEAD --name-only
Tips
- Commit messages matter: Write clear messages — they become the primary documentation
- Use
git log -S over grep for history: grep scans the working tree; git log -S scans history
- Combine with
ctx: Past agent sessions often contain context that git history doesn't
- Be specific with paths:
git log -- path/ filters to relevant commits, reducing noise
- Use
--all for complete picture: Default git log only shows current branch history
Integration with Other Skills
- Use before
/blindspots to gather initial context
- Use during
context-discovery for deep git history analysis
- Log surprising git history findings in
implementation-logger