Git PR Prompt
February 22, 2026 · View on GitHub
Generate AI-ready Pull Request descriptions and commit message prompts from your git history and staged changes. Copy a prompt to your clipboard and paste it into ChatGPT, Claude, Cursor, or any AI assistant.
Install from the VS Code Marketplace
Features
- Generate PR Prompt — Build a prompt from commits between your branch and a chosen parent (e.g.
main). Includes your PR template, commitlint rules, and optional extra context. - Generate Commit Message — Build a prompt from your staged diff and commitlint rules for AI-generated commit messages.
- Conventional Commits & Commitlint — Detects your project’s commitlint config and instructs the AI to follow it.
- Customizable prompts — Override the default prompts with Mustache templates (see Custom templates).
- Excluded files — Exclude files from diffs via regex or glob patterns (e.g. lockfiles, generated code).
- Multi-root workspaces — Pick the workspace folder when you have more than one.
Commands
| Command | Description |
|---|---|
| Generate PR Prompt | Select workspace → parent branch → (optional) extra context → prompt copied to clipboard. |
| Generate Commit Message | Select workspace (if needed) → prompt with staged diff copied to clipboard. |
Run from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
Configuration
In Settings → search for Git PR Prompt (or edit settings.json under gitPrPrompt).
| Setting | Type | Default | Description |
|---|---|---|---|
gitPrPrompt.excludedFilesRegex | string[] | [] | Regex patterns for file paths to exclude from diffs (e.g. "\\.lock$", "dist/.*"). |
gitPrPrompt.excludedFilesGlobs | string[] | [] | Git glob pathspecs to exclude (e.g. "*.lock", "dist/*"). Merged with default lock-file exclusions. |
gitPrPrompt.prPromptTemplate | string | "" | Custom Mustache template for the PR prompt. Empty = use built-in template. |
gitPrPrompt.commitPromptTemplate | string | "" | Custom Mustache template for the commit message prompt. Empty = use built-in template. |
Custom templates (Mustache)
Use Mustache syntax to customize prompts. Variables are passed as described below; use {{{variable}}} for unescaped content (e.g. markdown/diffs).
PR prompt variables:
template— Contents of.github/pull_request_template.md(or “No pull request template found.”).commitlintSection— Formatted commitlint section (or empty).commitSection— Commit blocks (hash, subject, diff) joined.extraContext— Optional text from the “extra context” input.hasCommitlint— Boolean: commitlint config was found.hasExtraContext— Boolean: user entered extra context.
Commit prompt variables:
commitlintSection— Same as above.diff— Staged diff text.hasCommitlint— Boolean.
Example settings.json snippet for a custom PR prompt:
{
"gitPrPrompt.prPromptTemplate": "Write a PR description.\n\n## Template\n{{{template}}}\n\n## Commits\n{{{commitSection}}}"
}
Project setup the extension uses
- PR template — If present,
.github/pull_request_template.md(any depth under.github) is included in the PR prompt. - Commitlint — Config is read from
.commitlintrc*,commitlint.config.*, orpackage.json→commitlint.
Requirements
- VS Code
^1.109.0 - Git in
PATH - For PR prompt: at least one remote branch and commits on your branch not in the parent
- For commit prompt: staged changes (
git add)
Troubleshooting
- “No commits found between … and HEAD” — Make sure you have local commits that are not on the selected parent branch.
- “No staged changes found” — Stage files with
git addbefore running Generate Commit Message. - “Failed to get git log” / “Failed to get staged changes” — Ensure the chosen folder is a git repo and Git is available in the terminal.
Development
pnpm install
pnpm run compile # typecheck, lint, build
pnpm run watch # watch build
License
MIT