| name | git-history-forensics |
| description | Git 历史追溯与文档完整性验证 - 追踪功能/概念的引入时间、演变过程,发现文档遗漏。
当用户问"X呢"、"Y什么时候加的"、"之前的Z呢"时使用。
Use when user asks "what about X", "when was Y added", "what happened to Z before date".
|
| version | 1.0.0 |
| keywords | ["git-history","forensics","documentation-audit","commit-tracing"] |
Git 历史追溯与文档完整性验证
触发场景
- 用户问"X呢?"、"Y怎么不见了?"
- 用户问"这个功能什么时候加的?"
- 用户问"某个日期之前的情况?"
- 需要验证文档是否完整覆盖代码变更
核心流程
Step 1: 确认追溯目标
Step 2: 搜索代码文件
find . -name "*keyword*" -type f 2>/dev/null | grep -v ".git" | grep -v "node_modules"
find . -name "*self_evolution*" -o -name "*darwin*" 2>/dev/null | grep -v ".git"
Step 3: 追踪 Git 历史
git log --all --oneline --grep="keyword" | head -20
git log --all --oneline -- path/to/file | head -20
git log --all --oneline --after="YYYY-MM-DD" --before="YYYY-MM-DD" | head -20
git show <commit-hash> --stat
git show <commit-hash> -- path/to/file
Step 4: 查看文件内容
git show <commit-hash>:path/to/file
git log --all -p -- path/to/file | grep -A 20 -B 5 "keyword"
Step 5: 验证文档覆盖
grep -n "keyword" README.md
grep -n "keyword" FORK_COMPARISON_REPORT.md
实战案例
案例1:追溯"自进化系统"
find . -name "*self_evolution*" -type f
git log --all --oneline --grep="self.*evolution" | head -10
git log --all -p -- README.md | grep -A 20 "self-improving"
案例2:追溯"Holographic Memory"
find . -name "holographic*" -type f
git log --all --oneline -- plugins/memory/holographic/ | head -10
git show 44b7df409 --stat
案例3:追溯"某个日期之前"
git log --all --oneline --before="2026-05-01" -- README.md | head -30
git show <commit-hash>:README.md | head -50
输出格式
发现遗漏时
## 📋 [功能名称] 演变历史
### [日期] (commit [hash])
**提交信息**:
[commit message]
**核心变更**:
- [变更1]
- [变更2]
**文件列表**:
- `path/to/file1` — 说明
- `path/to/file2` — 说明
更新文档时
git add README.md FORK_COMPARISON_REPORT.md
git commit -m "docs: 补充 [功能名称] 详细说明"
git push
常用 Git 命令速查
| 场景 | 命令 |
|---|
| 搜索提交信息 | git log --all --oneline --grep="keyword" |
| 搜索文件变更 | git log --all --oneline -- path/to/file |
| 按日期范围 | git log --all --oneline --after="YYYY-MM-DD" --before="YYYY-MM-DD" |
| 查看提交详情 | git show <hash> --stat |
| 查看历史文件内容 | git show <hash>:path/to/file |
| 查看完整 diff | git log --all -p -- path/to/file |
注意事项
- 使用
--all — 搜索所有分支,不只是当前分支
- 使用
rtk 前缀 — 节省 token(如 rtk git log)
- 验证文件存在 —
find 前先确认当前目录
- 检查文档覆盖 — 追踪完成后必须验证 README/文档是否提到
- 提交前预览 —
git show 查看完整内容,避免遗漏
Done When