Communicate better in your commits

Write clear, concise Git commit messages to help your future self and your team understand your changes. Use the following guidelines:

  • Headline (Subject Line):
    • Short (under 50 characters).
    • Start with a capital letter.
    • Use imperative mood (e.g., “Fix bug,” not “Fixed bug”).
    • No ending punctuation.
    • Include the type of change (e.g., feat, fix, chore, docs, etc.).
  • Body (Optional):
    • Explain the “what” and “why” of the change in more detail.
    • Keep lines under 72 characters.
    • Use BREAKING CHANGE: if applicable.
  • Footer (Optional):
    • Include issue tracker IDs (e.g., Closes JIRA-123).

One-liner Commits (When Appropriate):

For very simple changes, a one-liner commit message in the headline can be sufficient. For example:

fix: Correct typo in documentation

Or:

feat: Add support for new file format

Use the body for more complex changes that require additional explanation. One-liners are great for quick fixes or small features where the change is obvious.

Example (Including a one-liner example):

fix(authentication): Fix login issue with invalid credentials

This resolves the login problem where users with invalid credentials were unable to access their accounts.

Closes ISSUE-456

One-liner example:

style: Format code according to PEP 8

Why bother? Good commit messages save time, improve collaboration, and serve as valuable documentation. Follow your team’s conventions. Use one-liners for simple changes and more detailed messages for complex ones.

Scroll to Top