| description | Create a pull request from current branch with automatic title resolution | |||||
|---|---|---|---|---|---|---|
| argument-hint | [pr-title] | |||||
| allowed-tools |
|
現在のブランチから PR を作成します。ブランチ名からタスク ID を自動抽出し、Notion MCP を使用してタスクのタイトルを自動設定します。
使用方法:
/pr # タイトル自動解決
/pr "My PR Title" # カスタムタイトル指定
このコマンドは以下の処理を自動実行します:
- 現在のブランチを確認
- ブランチ名からタスク ID を抽出(feature/xxx 形式)
- Notion MCP でタスクを検索してタイトルを取得
- 現在の変更を commit & push
- GitHub MCP サーバーを使用して PR を作成
- プロジェクトの.github/pull_request_template.md テンプレートを適用
現在のブランチが feature/ で始まる場合、その後の文字列をタスク ID として抽出します。
抽出されたタスク ID を使用して Notion でタスクを検索し、タイトルを取得します。
- タスクが見つかった場合:そのタイトルを使用
- タスクが見つからない場合:作業内容から推測したタイトルを生成
GitHub MCP 連携でプルリクエストを作成し、適切なテンプレートを適用します。
# feature/create-pr-command ブランチで実行
/pr
# → "PR作成コマンド機能の実装" というタイトルで自動作成
# カスタムタイトル指定
/pr "新しいPR作成機能を追加"このコマンドにより、開発者はブランチ名の命名規則に従うだけで、適切なタイトルの PR が自動作成されます。
/pr qa/epsilon # qa/epsilon をベースに PR 作成
/pr "タイトル" main # main をベースに PR 作成(デフォルト)
引数の末尾が既知のベースブランチ名(main, qa/epsilon, qa/delta 等)の場合、そのブランチをベースとして PR を作成します。
重要: feature ブランチから直接 qa/epsilon へ PR を作成してはいけません。
feature/xxx ──PR──→ qa/epsilon ← ❌ feature/xxx に qa/epsilon を merge すると main が汚染される
feature/xxx ──PR──→ main ← このPRに qa/epsilon の未検証コードが混入
qa/epsilon を feature/xxx に merge して conflict を解消すると、feature/xxx → main の PR に qa/epsilon 固有のコードが混入します。
- qa/epsilon から短命ブランチを作成
- feature ブランチから必要なコミットだけを cherry-pick
- 短命ブランチから qa/epsilon へ PR を作成
# 1. qa/epsilon の最新を取得
git fetch origin qa/epsilon
# 2. qa/epsilon から短命ブランチを作成
git checkout -b feature/xxx-for-epsilon origin/qa/epsilon
# 3. feature ブランチから必要なコミットを cherry-pick
git cherry-pick <commit-hash-1> <commit-hash-2> ...
# 4. conflict があれば解決して continue
git cherry-pick --continue
# 5. push して PR 作成
git push -u origin feature/xxx-for-epsilon
gh pr create --base qa/epsilon --title "feat: ○○機能(epsilon検証用)"# feature ブランチの全コミットを確認(main から分岐後)
git log --oneline main..feature/xxx
# 特定ファイルに関するコミットだけ確認
git log --oneline main..feature/xxx -- path/to/file.php| ケース | 方法 |
|---|---|
feature/xxx → main |
通常通り PR 作成 |
feature/xxx → qa/epsilon |
短命ブランチ + cherry-pick で PR 作成 |
| conflict 解消で qa/epsilon を merge | ❌ 禁止(main 汚染の原因) |