Library › Coding AI › Software developers

Write a revert commit message in your team's format

Practice: Asking for a format you can use. About 5 minutes.

About this exercise

You're reverting the fuzzy-search commit after last night's incident. Your team's revert format: subject 'revert(search): <original subject after the colon> (<short sha>)', a blank line, 'Reason: <under 15 words>', then the trailers 'Incident: INC-2291' and 'Approved-by: Mira Okafor' as the last two lines. Only you know the reason: p95 search latency went from 180ms to 2.4s. Put the message in exactly 1 code block of at most 5 non-empty lines, under 10 words outside it.

Common mistakes when you ask AI for this

  • Git's default subject. The AI writes Revert "feat(search): ...", which your changelog tool can't parse. Try: Show it: "Subject: revert(search): add fuzzy matching (4e1a9c2)".
  • A vague reason. The AI writes 'caused issues' because it doesn't know what happened. Try: Add: "Reason: p95 search latency went from 180ms to 2.4s."
  • Missing trailers. Your release checks look for the incident and approver lines. Try: Add: "Last two lines: Incident: INC-2291 and Approved-by: Mira Okafor."
  • Extra text. The AI adds git commands and a note about the flag commit. Try: Add: "Only the message in one code block, nothing else."

What a strong prompt includes

  • Gives the subject format
  • Gives the real reason
  • Adds the trailers
  • Picks the right commit
  • Asks for only the message

Practice this now ↑

Related exercises