GitHub Copilot

Verified against GitHub Copilot · 2026-07-08

Get a commit message that explains why, not a restatement of the diff

A prompt for Copilot's Source Control commit-message generation that forces a why-focused message instead of the tool's default file-list summary.

GitHub Copilot (VS Code Source Control)

The prompt

Ready to copy — highlighted parts are example details you can swap.

Generate the commit message for the currently staged changes. Do not describe the diff mechanically ("updated file X", "added function Y") — a commit message that just restates the diff tells a future reader nothing the diff itself did not already show.

CONTEXT FOR WHY THIS CHANGE EXISTS
Support ticket JIRA-4821: three customers hit an export crash this week when filtering a report to an empty date range.

TICKET OR ISSUE
JIRA-4821

Format as:
Subject line — imperative mood, under 72 characters, states the effect of the change, not the mechanism ("Fix zero-row CSV export crash", not "Add null check to formatRowCount").
Body — one short paragraph on why this was necessary, referencing the ticket if given, then a line noting anything a reviewer of this commit later should know that is not obvious from the diff alone, such as a deliberate tradeoff or a follow-up left for later.

If the staged diff contains changes that look unrelated to the context given, say so instead of writing one message that quietly covers both.
Customize the highlighted detailsoptional — the prompt above already works

Why this works

Copilot's Source Control integration generates a commit message from the staged diff via a one-click action, and left to the diff alone it produces a mechanically accurate but low-value summary — it can see what changed but not why, because the why usually lives in a conversation, a ticket, or a decision that never appears in the code itself. Supplying that context explicitly is the only way to get it into the message at all; the tool is not being under-prompted so much as working from strictly less information than the human who staged the change actually has. The instruction to distinguish effect from mechanism in the subject line matters because a diff-derived summary defaults to describing the mechanism, since that is the part visible in the patch, while the effect — what the fix accomplishes for a user or a future reader scanning git log — is exactly the part that has to be supplied or inferred from context rather than read off the diff. Flagging unrelated staged changes rather than folding them into one narrative also catches a real, common problem: a generated commit message will happily produce one coherent-sounding story for two unrelated staged changes, which hides a mixed commit a reviewer would otherwise ask to be split.

What you get back

Fix zero-row CSV export crash Exporting a report filtered to zero matching rows threw a TypeError in formatRowCount, since dividing by a zero total produced NaN and NaN.toFixed() throws. Guarded the calculation to return "0.0" when total is zero. Closes JIRA-4821. Note: the same unguarded pattern exists in formatAverageValue and is tracked separately, not fixed here.

Verified against

GitHub Copilot VS Code Source Control integration, 1.260 · 2026-07-08

Changelog

  • 2026-07-08 Initial publish, verified against the Copilot VS Code Source Control integration.

Need this built into your business?

If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All GitHub Copilot prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY