AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Configure Continue with Custom Git Diff Context for Conventional Commits in VS Code

Clarissa Ang · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Context switching kills developer velocity. Few everyday chores prove this more vividly than writing git commit messages. After spending three hours tracking down a race condition across five files, most engineers do not want to craft a textbook changelog entry. They type git commit -m "fix bug" or git commit -m "updates", promise themselves they will squash it later, and move on.

At 365Finds, we consider commit messages a permanent architectural record, not disposable scratchpads. While VS Code extensions and proprietary tools like GitHub Copilot offer built-in commit generation, they suffer from two frustrating flaws: they lock you into closed models, and they rarely adhere to your team's exact Conventional Commits rules.

Continue changes the math. As an open-source AI code assistant for VS Code and JetBrains, Continue allows developers to plug in any LLM—from local models like Qwen 2.5 Coder running on Ollama to frontier APIs like Claude 3.5 Sonnet—and expose granular IDE context. By coupling Continue's @diff context provider with custom prompt templates, you can turn messy staged diffs into disciplined Conventional Commits with a single keystroke.

Here is how 365Finds recommends setting up and refining this workflow.


Understanding the Engine: How Continue Reads Git Diffs

Continue feeds workspace information to LLMs through Context Providers. When you type @ in the Continue chat panel (Ctrl+L on Linux/Windows, Cmd+L on macOS), you summon providers like @file, @code, and @diff.

The @diff provider inspects your active Git branch and injects uncommitted modifications directly into the prompt payload. Under the hood, Continue executes workspace git diff queries to assemble the added and removed lines across modified files.

However, standard @diff in chat captures workspace changes broadly. For clean commit workflows, you care about what is staged in the index, not stray experiments in your working tree. To make this dependable, Continue offers two configuration routes:

  1. Prompt Files (.prompt or .md): Markdown files with YAML frontmatter that declare reusable slash commands.
  2. config.yaml / config.ts custom commands: Declarative or programmatic definitions that pull staged diffs via Continue's IDE SDK.

365Finds strongly favors Prompt Files. They can live inside your project repository, allowing your entire team to share the exact same commit conventions and scope definitions without touching global machine configs.


Step-by-Step Configuration

Method 1: The Repository-Level Prompt File (Recommended)

To establish a shared standard across your engineering team, create a dedicated prompt file inside your workspace root.

  1. In your project root, create the folder .continue/prompts/.
  2. Create a file named commit.prompt (or commit.md).
  3. Add the following YAML frontmatter and instruction template:
---
name: commit
description: Generate Conventional Commit message from staged git diff
invokable: true
---

You are an expert Git release engineer. Analyze the provided git diff and generate a standardized commit message strictly adhering to the Conventional Commits 1.0.0 specification.

Git Diff Context:
{{{ input }}}

Formatting Rules:
1. The message must follow: `<type>(<optional scope>): <subject>`
2. Allowed types:
   - feat: A new feature
   - fix: A bug fix
   - docs: Documentation only changes
   - style: Formatting, missing semi colons, no code change
   - refactor: Code change that neither fixes a bug nor adds a feature
   - perf: Code change that improves performance
   - test: Adding missing tests or correcting existing tests
   - build: Changes affecting build system or external dependencies
   - ci: Changes to CI configuration files and scripts
   - chore: Other changes that do not modify src or test files
3. Subject requirements:
   - Use the imperative present tense ("add", not "added" or "adds").
   - Do not capitalize the first letter of the subject.
   - Do not place a period at the end of the subject line.
   - Keep the subject line under 72 characters.
4. Body requirements (optional, only if change is non-trivial):
   - Leave one blank line between the subject and the body.
   - Explain *what* changed and *why*, never *how* (the diff already shows how).
   - Use concise bullet points if multiple files were updated.
5. Footer (optional):
   - If breaking change, start with `BREAKING CHANGE: <explanation>`.
   - Reference issue numbers if applicable (e.g., `Closes #42`).

Output Constraints:
- Output ONLY the commit message inside a single markdown code block.
- Do not include conversational preambles ("Here is your commit message:") or closing thoughts.

Setting invokable: true in the frontmatter registers /commit as an active slash command inside the Continue panel.


Method 2: Global Configuration in config.yaml

If you prefer to carry your commit assistant across every project on your workstation, configure it globally in ~/.continue/config.yaml:

version: 1.0.0
name: Global Developer Config

context:
  - provider: diff

prompts:
  - name: commit
    description: Generate Conventional Commit from git diff
    prompt: |
      Analyze the following git diff and write a Conventional Commit message:
      {{{ input }}}

      Rules:
      - Format: <type>(<scope>): <subject>
      - Allowed types: feat, fix, refactor, perf, test, docs, chore, build, ci
      - Imperative tense, lowercase subject, no trailing period, max 72 chars.
      - Output raw text only. No commentary.

Method 3: Programmatic Staged Diff via config.ts

If your project requires filtering strictly staged changes while ignoring unstaged modifications, Continue's TypeScript configuration (~/.continue/config.ts) provides native IDE SDK calls:

import { Config } from "@continuedev/config-types";

export function modifyConfig(config: Config): Config {
  config.slashCommands?.push({
    name: "commit",
    description: "Generate Conventional Commit from staged changes only",
    run: async function* (sdk) {
      // Passing true isolates staged changes from working tree modifications
      const stagedDiff = await sdk.ide.getDiff(true);

      if (!stagedDiff || stagedDiff.trim() === "") {
        yield "365Finds notice: No staged changes detected. Please stage your files (`git add`) before generating a commit.";
        return;
      }

      const prompt = `
Generate a Conventional Commit message based solely on this staged git diff:
\`\`\`diff
${stagedDiff}
\`\`\`

Format: <type>(<scope>): <subject>
- Types: feat, fix, refactor, docs, style, test, perf, chore
- Max 72 characters on first line.
- Return only the commit message block.
`;

      const controller = new AbortController();
      for await (const chunk of sdk.llm.streamComplete(prompt, controller.signal, { maxTokens: 200 })) {
        yield chunk;
      }
    },
  });

  return config;
}

Daily Execution Workflow in VS Code

Once your prompt or slash command is configured, incorporating it into your routine takes seconds:

  1. Stage your intentional changes: In the VS Code Source Control panel (or terminal), run git add <files>. Never stage blindly; clean commits begin with clean staging.
  2. Open Continue: Press Ctrl+L (or Cmd+L) to focus the chat input.
  3. Execute the command:
    • If using Method 1 or 2: Type /commit @diff and press Enter. The @diff badge attaches the workspace diff to the prompt.
    • If using Method 3: Type /commit and press Enter. The SDK retrieves staged diffs programmatically.
  4. Copy into Source Control: Continue streams the formatted message. Click the copy icon and paste it into the VS Code Source Control input field.
  5. Human verification: Read the subject line. If the model misidentified a refactoring as a feature, correct the type prefix before committing.

365Finds Analysis: Practical Realities and Traps

Automated commit generation is not magic. In our testing at 365Finds, teams encounter three recurring points of failure:

1. The Context Explosion Pitfall

Running @diff when you have updated pnpm-lock.yaml, generated minified JS bundles, or compiled binaries will flood the LLM context window with thousands of useless tokens. The model either truncates or produces a hallucinatory summary like chore: update dependencies. Our recommendation: Add compiled assets and lockfile churn to .gitignore or stage code files selectively (git add src/) before calling @diff.

2. Choosing the Right Model Tier

Do not waste expensive reasoning frontier models (like o1 or Claude 3.5 Opus) on commit messages. Fast, lightweight models like Claude 3.5 Haiku, GPT-4o-mini, or a locally hosted Qwen 2.5 Coder 7B/14B process a 50-line diff in less than two seconds with near-perfect adherence to format rules.

3. Shared Repository Ownership

Personal dotfiles do not scale across a team. Placing .continue/prompts/commit.prompt directly into your Git repository turns commit hygiene into shared code infrastructure. When your architecture introduces a new package or service, update the prompt's allowed (scope) list in that same pull request.

References