Skip to content

Conventional Commits

Joanna edited this page Aug 5, 2023 · 3 revisions

Conventional Commits

General rules

  1. Conciseness: Strive to create short yet descriptive commit messages. Use as few words as possible to clearly explain the introduced changes.

  2. Description of Changes: Commit messages should include information about what has been changed or added. Avoid vague messages that don't clarify the essence of the changes.

  3. Use Present Tense: Use the present tense in commit messages as changes are presented as actions that have been taken.

  4. Avoid Unnecessary Details: Refrain from providing information that is already evident in the code or is too obvious. Focus on the crucial aspects of the changes.

  5. Use Action Verbs: Naming changes with action verbs in the present tense (e.g., "Add," "Update," "Delete") helps precisely define what has been done.

  6. Avoid Naming Multiple Changes in One Commit: Try to focus on a specific and single change in each commit message. This makes tracking the history of changes in the repository easier.

  7. Check Spelling and Punctuation: Ensure that commit messages are well-written without spelling or punctuation errors.

  8. Acronyms and Abbreviations: When dealing with long commit messages, you may use acronyms or abbreviations, provided they are clear to other team members.

How to start the commit message

feat: New functionality
fix: Fix to an existing functionality
docs: Changes only in documentation
chore: Changes that do not affect the source code or tests (e.g., package updates)
refactor: Changes that are neither fixes nor new features
tests: Changes related to tests (addition or modification)
perf: Code changes that improve performance
styles: Code formatting, white spaces, commas, or missing semicolons
ci: Changes related to Continuous Integration (configs, scripts)
build: Changes affecting the build process
revert: Revert previous changes

Ideal commit message

The ideal commit message should:

  • Concisely describe the changes that occurred in the code.
  • Be in the imperative present tense. This means it should use commands like "add," "update," "fix," etc., instead of descriptive phrases like added polish translations or adding polish translations. Instead, it should be add polish translations

Examples

refactor: refactor code for better performance

fix: fix bug in login validation

feat: add user profile feature

Following these guidelines for commit message names helps maintain clarity in the history of changes in the repository, facilitating team collaboration and code debugging. Strive to be consistent in naming commit messages to make reviewing and understanding changes easier.

Clone this wiki locally