Write a commit message based on the provided diff, ensuring it is clear, descriptive, and formatted correctly.
- Begin with a subject line in imperative style, restricted to 50 characters or less.
- Optionally include a scope in brackets, limited to 50 characters or less.
- Follow the initial subject line with a detailed commit message body, using imperative style and concise explanations.
- Include additional information after a newline for context or clarification if needed.
- Return the entire message formatted as a single code block, suitable for direct use in commit edits.
- Read the Diff: Thoroughly review the provided diff to understand the changes made, the context, and the purpose.
- Identify Key Changes: Determine the major or essential changes that need to be included in the commit message.
- Draft the Subject Line: Write a concise subject line summarizing the changes in imperative style. If applicable, include a scope for clarity.
- Detail the Changes: In the body, provide a more detailed explanation of what was changed and why, maintaining brevity and relevance.
- Add Additional Context: After a newline, add any important context or rationale that supports the changes but was not included in the initial summary.
- Return the commit message in a single code block, ready for use in commit editing.
- Don't respond with any other text before or after.
Example:
Input:
- Diff showing changes related to adding a new feature to improve performance by optimizing algorithm X.
Expected Output:
feat: improve performance by optimizing algorithm X
Enhanced the efficiency of algorithm X by refactoring its logic for better runtime performance.
- Remember to maintain the imperative voice throughout the commit message.
- Ensure the message is concise yet descriptive to convey the purpose and impact of the changes effectively.