Skip to content

Conventional Commit Messaging Format

DupelaWebsite edited this page Sep 9, 2024 · 4 revisions

Commitizen bumps versions based on specific commit types (e.g., feat, fix, etc.). To avoid generating unnecessary releases during branch development, adhere to the proposed conventional commit messaging structure.

git commit -m "type(scope): description"

Type

These describe the kind of change you're making:

  • new: Introducing a new feature or functionality.
  • update: Enhancing or improving existing code without breaking backward compatibility.
  • fix: Fixing a bug or issue in the application.
  • remove: Removing or deprecating code, files, or features.
  • refactor: Restructuring or cleaning up code without changing its behavior.
  • test: Adding or updating tests.
  • docs: Documentation updates.
  • chore: Routine tasks that don't modify application behavior (e.g., dependency updates, build changes).
  • style: Code styling changes (formatting, indentation, etc.).
  • perf: Performance improvements.
  • ci: Continuous integration or build system changes.

Scope

These specify the area of the codebase affected. Use whatever is appropriate for your project:

  • new: Introducing a new feature or functionality.
  • update: Enhancing or improving existing code without breaking backward compatibility.
  • fix: Fixing a bug or issue in the application.
  • remove: Removing or deprecating code, files, or features.
  • refactor: Restructuring or cleaning up code without changing its behavior.
  • test: Adding or updating tests.
  • docs: Documentation updates.
  • chore: Routine tasks that don't modify application behavior (e.g., dependency updates, build changes).
  • style: Code styling changes (formatting, indentation, etc.).
  • perf: Performance improvements.
  • ci: Continuous integration or build system changes.
  • frontend: For changes to the UI or client-side code.
  • backend: For changes in server-side logic or database interactions.
  • api: Changes or additions to API endpoints.
  • auth: Authentication-related changes.
  • db: Database-related changes (migrations, schema updates).
  • ui: Changes in the user interface (can be part of frontend).
  • deps: Dependency-related changes, e.g., updating libraries or packages.
  • config: Configuration changes.
  • tests: Test-related changes or improvements.
  • docs: Documentation-related changes.

Guidelines for Writing Descriptions

The description should provide a brief and clear explanation of what has been done. Follow these guidelines:

Be concise but informative:

  • Describe the change in a simple and straightforward way.
  • Avoid unnecessary details that don't add value to the commit.

Use imperative mood:

  • Write the message as if you are commanding the change, e.g., "Add", "Fix", "Remove", not "Added", "Fixed", or "Removed".
  • Example: new(frontend): implement user profile page instead of Added user profile page.

Focus on what and why, not how:

  • Explain what was changed and why it was done. Details on how it was done belong in the code review or documentation.
  • Example: fix(backend): resolve user login failure when token expires focuses on the issue resolved, not the specific method used to fix it.

Stay relevant to the scope:

  • Keep the description relevant to the scope. If you're working in multiple scopes, you might want to split the commit.

Avoid overly technical jargon:

  • Make sure your description is understandable by someone unfamiliar with the specific code changes but familiar with the project.

Samples

Feature Additions (new)

new(frontend): implement user dashboard UI

Description: Adds a new user dashboard interface on the frontend.

new(backend): introduce email notification service

Description: Adds a backend service to send email notifications.

new(api): create endpoint for password reset

Description: Adds a new API endpoint for handling password reset functionality.

Updates and Improvements (update)

update(frontend): improve responsiveness for mobile

Description: Enhances the responsiveness of the UI for mobile devices.

update(backend): optimize user query performance

Description: Refactors the user database query for better performance.

update(api): extend user data in profile response

Description: Updates the API to include more user data in profile responses.

Bug Fixes (fix)

fix(frontend): correct broken form validation on submit

Description: Fixes an issue with form validation not triggering on submit.

fix(backend): handle edge case in token expiration

Description: Fixes a bug where certain token expiration edge cases weren't handled correctly.

fix(api): resolve 404 error for profile fetch

Description: Fixes an issue where the profile fetch API was incorrectly returning a 404 error.

Removals (remove)

remove(frontend): delete deprecated user settings page

Description: Removes the old user settings page that is no longer in use.

remove(backend): remove unused utility functions

Description: Cleans up the backend by removing unnecessary utility functions.

remove(api): deprecate old user profile endpoint

Description: Deprecates an old API endpoint for fetching user profiles.

Refactoring (refactor)

refactor(frontend): reorganize components for better readability

Description: Improves the structure of frontend components for easier maintenance.

refactor(backend): simplify authentication middleware

Description: Refactors the authentication middleware to make it simpler and more efficient.

refactor(api): restructure API response handling logic

Description: Cleans up how API responses are handled without changing their functionality.

Testing (test)

test(frontend): add unit tests for login component

Description: Adds unit tests for the frontend login component.

test(backend): increase test coverage for auth service

Description: Improves test coverage in the authentication service.

test(api): mock external API calls in integration tests

Description: Adds mocked external API calls for improved integration testing.

Documentation (docs)

docs(frontend): update README with setup instructions

Description: Updates the README with instructions on setting up the frontend.

docs(backend): add documentation for new email service

Description: Adds detailed documentation for the newly added email notification service.

docs(api): document password reset endpoint

Description: Adds documentation for the password reset API endpoint.

Chore (chore)

chore(frontend): upgrade React to latest version

Description: Upgrades React to the latest version in the frontend.

chore(backend): update dependencies in package.json

Description: Updates backend dependencies in the package.json file.

chore(ci): configure build pipeline for faster deployments

Description: Adjusts the CI pipeline to improve deployment speed.

Styling (style)

style(frontend): apply consistent button padding

Description: Standardizes button padding across the frontend UI.

style(backend): format code to meet style guide

Description: Formats backend code to follow the project's style guide.

Performance (perf)

perf(frontend): improve image loading speed

Description: Optimizes frontend image loading for faster performance.

perf(backend): reduce query execution time

Description: Speeds up database query execution for better backend performance.

CI/CD (ci)

ci(deploy): add deployment step to build pipeline

Description: Adds a deployment step to the continuous integration pipeline.

ci(test): configure parallel test execution in CI

Description: Improves the CI pipeline by enabling parallel test execution.

Clone this wiki locally