This guide will help you understand how to effectively use commit messages in your version control system. A good commit message is crucial for maintaining a clean and understandable repository history.
Basic Structure
A good commit message typically follows this structure:
- Subject: A brief summary of what the commit does (50 characters or less).
- Body: A more detailed description of what was changed and why (optional).
- Footer: Additional information such as the issue number it fixes or who contributed the commit (optional).
Example
fix: Corrected typo in documentation
This commit fixes a typo in the documentation. The typo was "contribution" instead of "contributions".
Best Practices
- Be concise: Keep the subject line short and to the point.
- Be informative: Explain what the commit does and why it was made.
- Use imperative mood: Write the subject line in imperative mood (e.g., "fix", "add", "change").
- Separate paragraphs: Use a blank line to separate the subject line from the body.
- Use issue references: Mention the issue number if the commit fixes or relates to an issue.
Additional Resources
For more detailed information, check out our commit message best practices.
commit-message