Skip to content

Instantly share code, notes, and snippets.

@GabbasovDinar
Last active January 13, 2025 06:50
Show Gist options
  • Save GabbasovDinar/13744a909b0ec640f235bb653fcfc2d4 to your computer and use it in GitHub Desktop.
Save GabbasovDinar/13744a909b0ec640f235bb653fcfc2d4 to your computer and use it in GitHub Desktop.
Commit Message Tags: Best Practices for Clear and Consistent Version Control

Commit Message Tags and Branch Naming Rules

To ensure consistency and clarity in our Git workflow, follow these rules for commit messages and branch names.

Commit Message Tags

When creating commit messages, include an appropriate tag at the beginning of the message.

Name Code Description
New Module [NEW] Use when creating new modules
Refactoring [REF] Code works fine but is reorganized for better structure or maintainability
Critical Fixes [FIX] Fixes issues that previously caused incorrect behavior
Feature Improvement [IMP] Enhancements in performance or addition of new functionality
Views and Templates [VIEW] Changes to views, QWeb templates, or assets
Demo Data [DEMO] Updates related to demo data
Data Files [DATA] Updates related to data records
Access Rights [ACC] Updates to security and access rights
Documentation [DOC] Updates to .rst files, static/description, or manifest
Pricing Updates [PRICE] Changes in the pricing information in the manifest
Translations [I18N] Updates or additions to translations
Tests [TEST] Updates related to tests
Linting [LINT] Fixing linting issues (e.g., spacing, unused imports, formatting)
Porting [PORT] Porting a module to a new Odoo version
Removal [DEL] Removal of modules or obsolete code

Commit Message Format

Commit messages must follow this format:

[ODOO_VERSION: e.g., 16.0][TAG] <module_name>: #<ISSUE_LINK> Short Description

Example:

[16.0][IMP] web_notify: #12345 Add sound to notifications

Key Rules:

  1. One Commit Per Module: A single commit should only include changes related to one module. If multiple modules are affected, create separate commits for each module.
  2. Issue Linking: Include the task or issue number and, if possible, a direct link to the issue.

Title (subject line):

  • Short (50 characters or less without including module name, task number, tag, and Odoo version) and descriptive.
  • Written in the imperative mood (e.g., "Fix bug", "Add feature" rather than "Fixed" or "Added").

Example:

[16.0][FIX] my_custom_module:issue#123 fee calculation

Description (mandatory):

  • Must be separated from the title with a blank line.
  • Wrap at 72 characters per line for readability.
  • Must explain what and why of the change (if not self-explanatory).
  • Can mention how only if necessary for clarification.

Branch Naming Rules

Branches should be named using the following format:

<ODOO_VERSION>-t<TASK_OR_ISSUE_NUMBER>-<MODULE_NAME>-<TAG>-<SHORT_DESCRIPTION>

Example:

16.0-t12345-web_notify-IMP-add-sound-to-notifications

Key Rules:

  1. Task or Issue Number: Include the task or issue number to link the branch to the related work item.
  2. Descriptive Names: Keep the branch name descriptive yet concise.
  3. Use Tags: Use one of the defined tags to specify the type of work being done.

Additional Notes

  • Use the strongest applicable tag when merging commits.
  • Ensure that commits and branch names are aligned with the task they address to maintain traceability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment