Commit Message Prompt (Gemini)
Good commit messages are as important as good code — they are the primary source of context when debugging production issues six months later. This prompt focuses on the WHY rather than the WHAT (which the diff already shows) and produces multiple subject line options so you can choose the level of detail appropriate for the change. This variant is formatted for Gemini: Optimised for Gemini 1.5 Pro and Gemini Ultra. Uses Google AI markdown formatting conventions.
# Gemini AI Prompt
You are a helpful AI assistant powered by Google Gemini.
## Instructions
You are an experienced software engineer who writes clear, informative commit messages.
Write a git commit message for the following change:
Git diff or change description:
{{diff_or_description}}
Convention: {{convention}}
Scope (optional): {{scope}}
Rules:
- Subject line: max 72 characters, imperative mood ("Add feature" not "Added feature")
- Body: explain WHY the change was made, not WHAT (the diff shows what)
- Reference any issue or ticket numbers
- Mark breaking changes with "BREAKING CHANGE:" in the footer
- {{additional_rules}}
Provide three subject line options (short, medium detail, full detail) and one recommended body.
## Output Format
Provide a well-structured response using Markdown headers and code blocks where appropriate.Variables
{{diff_or_description}}The git diff output (git diff --staged) or a plain description of the changes{{convention}}Commit convention: "Conventional Commits (feat/fix/chore)", "Angular", "plain descriptive", or "None"{{scope}}Optional scope, e.g., "auth", "api", "ui", or leave blank{{additional_rules}}Additional rules, e.g., "use present tense only", or "None"Example
convention: Conventional Commits scope: auth diff_or_description: Changed the JWT token expiry from 7 days to 1 hour. Updated the token refresh logic to automatically renew tokens when they are within 5 minutes of expiry. Added a new /auth/refresh endpoint. additional_rules: None
Options: 1. feat(auth): reduce JWT expiry to 1h with auto-refresh 2. feat(auth): shorten token lifetime and add automatic refresh 3. feat(auth): implement 1-hour JWT expiry with proactive refresh endpoint Body: Reduce token lifetime from 7 days to 1 hour to limit the impact of token theft. Tokens are automatically refreshed when they have less than 5 minutes of validity remaining, so users with active sessions will not be logged out. Adds POST /auth/refresh endpoint for manual refresh in non-browser clients. Refs #AUTH-142
Related Tools
FAQ
- What is the Conventional Commits format?
- Conventional Commits (conventionalcommits.org) uses a structured prefix: type(scope): description. Types include feat, fix, docs, style, refactor, test, chore. This format enables automatic changelog generation and semantic versioning.
- Should I always write a commit body?
- For significant changes (new features, bug fixes, breaking changes), always write a body explaining the rationale. For trivial changes (typo fixes, dependency updates), a subject line alone is sufficient.
- How do I generate messages for bulk commits in a squash workflow?
- Run `git log feature-branch --oneline` and paste the list of commits into diff_or_description. The AI will synthesise a single meaningful commit message that captures all the changes.
Related Prompts
Good commit messages are as important as good code — they are the primary source of contex...
Commit Message Prompt (ChatGPT)Good commit messages are as important as good code — they are the primary source of contex...
Commit Message Prompt (Claude)Good commit messages are as important as good code — they are the primary source of contex...
Commit Message Prompt (LLaMA / Ollama)Good commit messages are as important as good code — they are the primary source of contex...
Changelog Writing PromptMost changelogs are written by developers for developers, burying user-visible changes in ...
Code Review PromptThis prompt structures code reviews into five clear categories so the AI produces actionab...