Verified against GitHub Copilot · 2026-08-05
Get Copilot's commit message to explain why a change exists, not just list what moved
A prompt for Copilot's Source Control commit-message generation that supplies the context a diff alone never contains, so the generated message states the reason for the change instead of a mechanical restatement of the files it touched.
The prompt
Ready to copy — highlighted parts are example details you can swap.
Generate the commit message for the currently staged changes, but do not describe the diff mechanically — 'updated file X,' 'added function Y' — since a message that only restates the diff tells a future reader nothing the diff itself did not already show them directly. 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 THIS CLOSES JIRA-4821 AUDIENCE FOR THIS MESSAGE Other engineers reading git log later, not an end-user changelog. IF MORE THAN ONE UNRELATED THING GOT STAGED I also fixed an unrelated typo in the README while I was in there — flag that as a separate concern if it is still staged. FORMAT Subject line — imperative mood, under 72 characters, states the effect of the change on a user or a future reader, not the mechanism used to achieve it. 'Fix zero-row CSV export crash' names the effect; 'Add null check to formatRowCount' names the mechanism and leaves the actual reason this mattered unstated. Body — one short paragraph on why this was necessary, referencing JIRA-4821 if one exists, followed by a line naming anything a reviewer of this commit later should know that is not obvious purely from reading the diff — a deliberate tradeoff that was made on purpose, a follow-up that was intentionally left for later, or a related issue that this commit does not attempt to fix. CHECK BEFORE FINALIZING - If the staged diff contains a change that looks unrelated to Support ticket JIRA-4821: three customers hit an export crash this week when filtering a report to an empty date range., say so explicitly rather than writing one message that quietly covers both as if they were a single coherent piece of work — a generated message will happily produce one smooth-sounding narrative for two unrelated staged changes, and that smoothness is exactly what hides a commit that should have been split before it ever reaches review. - If Support ticket JIRA-4821: three customers hit an export crash this week when filtering a report to an empty date range. states a reason that the diff itself does not actually support — for example, a stated fix for a crash but the diff does not touch the function that would actually cause that crash — flag the mismatch rather than writing a confident message around a reason the diff does not back up. - Do not invent a plausible-sounding reason for the change if Support ticket JIRA-4821: three customers hit an export crash this week when filtering a report to an empty date range. is thin or missing; write the message from what the diff can support on its own and note explicitly that the why was not supplied, rather than filling the gap with a guess that reads as if it were known. WHAT A GOOD MESSAGE ACTUALLY EARNS A commit message that states the effect and the why is one a future git log or git blame session can act on without opening the diff first — that is the actual test a generated message should pass, not whether it accurately lists which lines changed, which the diff already shows without any message at all.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
Copilot's Source Control integration generates a commit message from the staged diff through a one-click action, and left to the diff alone it produces a mechanically accurate but genuinely low-value summary, because it can see exactly what changed but has no access to why, and the why almost always lives somewhere the diff itself cannot show — a conversation, a support ticket, a decision made in a meeting that never touched the code directly. Supplying that context explicitly is not a workaround for an under-prompted tool so much as the only way to get information into the message that the diff-only generation path structurally cannot reach on its own; no amount of clever prompting recovers information that was never in the input. The instruction to distinguish effect from mechanism in the subject line matters because a diff-derived summary defaults toward describing the mechanism specifically because the mechanism is the part visible directly in the patch — the effect, what the change actually accomplishes for a user or for a future engineer scanning git log without opening every commit, is exactly the part that has to come from supplied context rather than be read off the code, and a generation path with no such context reliably falls back to the mechanism because it is the only thing actually available to describe. Flagging unrelated staged changes rather than folding them into one narrative catches a real and common problem specific to how generation models handle multi-purpose input: asked to summarize a diff containing two unrelated changes, the model will produce one coherent-sounding story that covers both, and that coherence is the actual failure — a reviewer reading a smooth, well-written message has less reason to ask whether this commit should have been two commits than they would reading two visibly disconnected bullet points, so the more polished the generated message, the more effectively it can hide a mixed commit that should have been split before anyone reviewed it at all.
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 calling toFixed on NaN throws. Guarded the calculation to return a fixed zero value 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.271 · 2026-08-05
Changelog
- 2026-08-05 — 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
