agentleFS
h-watah-wata/claude-skills/skills/git-history/SKILL.md

git-history

Skill0 starsChanged 6 months agoApache-2.0View on GitHub

Git履歴を調査し、変更の経緯を追跡

The file

Files
SKILL.md

Git履歴調査スキル

使用方法

/git-history <ターゲット> [調査タイプ]

ターゲット

  • ファイルパス: src/main.py
  • 関数名/クラス名: handleRequest
  • コード断片: "特定の文字列"
  • コミットハッシュ: abc1234

調査タイプ(省略時は自動判定)

  • history: ファイルの変更履歴
  • blame: 行ごとの最終変更者
  • search: コード追加/削除の検索
  • diff: コミット間の差分

指示

ユーザーからの調査リクエストに対し、以下の手順で調査を行ってください。

1. 調査タイプの判定

ユーザーの質問に基づいて適切な調査方法を選択:

質問パターン調査方法
「いつ変更された?」ファイル履歴
「誰が変更した?」git blame
「なぜ削除された?」pickaxe検索 + コミット分析
「この関数の変遷は?」パッチ付き履歴
「2つのコミットの違いは?」diff分析

2. ファイル変更履歴の追跡

特定ファイルの変更履歴を調査する場合:

# 基本的な変更履歴(リネームも追跡)
git log --follow --oneline -- <ファイルパス>

# 詳細な変更内容付き
git log --follow -p -- <ファイルパス>

# 特定の関数/クラスに限定
git log -L :<関数名>:<ファイルパス>

3. コード追加/削除の検索(Pickaxe検索)

特定のコードがいつ追加・削除されたか調査:

# 文字列を含む変更を検索
git log -S "<検索文字列>" --oneline

# 正規表現で検索
git log -G "<正規表現>" --oneline

# パッチ付きで詳細確認
git log -S "<検索文字列>" -p

4. 行ごとの変更履歴(Blame)

現在のコードの各行がいつ変更されたか:

# 基本的なblame
git blame <ファイルパス>

# 特定の行範囲
git blame -L <開始行>,<終了行> <ファイルパス>

# コピー/移動も検出
git blame -C -C -C <ファイルパス>

5. コミット間の差分分析

# 2つのコミット間の差分
git diff <コミット1> <コミット2> -- <ファイルパス>

# 特定コミットの変更内容
git show <コミットハッシュ>

# 変更されたファイル一覧
git diff --name-only <コミット1> <コミット2>

6. 変更理由の調査

コミットメッセージと関連情報を分析:

# コミットの詳細情報
git show --stat <コミットハッシュ>

# コミットメッセージの検索
git log --grep="<キーワード>" --oneline

# 同時期の関連コミット
git log --since="<日付>" --until="<日付>" --oneline

出力フォーマット

調査結果は以下の形式で報告してください:

## 調査結果: <ターゲット>

### 概要
- 調査対象: <ファイル/コード>
- 調査期間: <最古のコミット> 〜 <最新のコミット>

### タイムライン
| 日時 | コミット | 変更内容 | 変更者 |
|------|---------|---------|--------|
| ... | ... | ... | ... |

### 重要な変更点
1. <コミットハッシュ>: <変更の説明>
   - 理由: <コミットメッセージからの推測>

### 結論
<ユーザーの質問に対する回答>

使用例

例1: ファイルの変更履歴を調査

/git-history src/utils/parser.py history

例2: 削除されたコードを探す

/git-history "handleError" search
→ 「handleError関数がいつ削除されたか」を調査

### 例3: 特定行の変更者を特定

/git-history src/main.py:42 blame


### 例4: 2つのバージョン間の変更を比較

/git-history v1.0.0..v2.0.0 diff


## 注意事項

- リポジトリのルートで実行してください
- 大量の履歴がある場合は `--since` や `-n` で絞り込んでください
- リネームされたファイルを追跡するには `--follow` を使用してください

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.