DEV Community

Thiago Marinho
Thiago Marinho

Posted on

Mastering Conventional Commits: A Hands-On Guide

When you're working with a team, it's great to use meaningful messages for your commits.

We have something called Conventional Commits, a guidelines for writing commit messages in software development projects.

Which includes 11 words and their meanings that you can use. It helps everyone understand your changes better!

Words and definition:

  1. feat: Signifies a new feature or enhancement added to the codebase.
  2. fix: Indicates a bug fix or resolving an issue in the code.
  3. docs: Refers to changes or additions to documentation.
  4. style: Denotes changes in code formatting, such as indentation, whitespace, etc., which do not affect the code's functionality.
  5. refactor: Represents code changes that neither fix a bug nor add a feature but improve the code's structure or readability.
  6. test: Indicates additions, modifications, or improvements to tests or testing-related code.
  7. chore: Refers to changes in build scripts, package management, or other project-related tasks.
  8. build: Denotes changes related to the build system or external dependencies.
  9. ci: Represents changes to the Continuous Integration (CI) configuration or pipeline.
  10. perf: Indicates code changes that improve performance.
  11. revert: Signifies reverting a previous commit or changeset.

An actual example of using Conventional Commits for a TODO app:

  1. feat: Add ability to set due dates for tasks
  2. fix: Resolve the issue with task deletion not working properly
  3. docs: Update user guide with instructions on organizing tasks into categories
  4. style: Adjust font size and color for task titles
  5. refactor: Reorganize code structure for improved task filtering
  6. test: Add test cases for task prioritization functionality
  7. chore: Update dependencies for better performance
  8. build: Fix build configuration for smoother deployment
  9. ci: Integrate automated testing into the continuous integration pipeline
  10. perf: Optimize loading speed for large task lists
  11. revert: Revert the previous commit that introduced a bug in task sorting.

Now, you can apply these concepts in your codebase 🚀

Top comments (1)

Collapse
 
tgmarinhodev profile image
Thiago Marinho

TL;DR pt-br:

Os tipos de commits mais comuns definidos pela convenção Conventional Commits são os seguintes:

feat: Este tipo de commit é utilizado quando uma nova funcionalidade é adicionada ao código.

fix: Usado quando um commit corrige um bug existente no código.

docs: Este tipo de commit é reservado para atualizações ou adições à documentação do projeto.

style: Quando uma mudança é feita no código que não afeta o seu comportamento (por exemplo, formatação, espaçamento), este tipo de commit é utilizado.

refactor: Usado para commits que não adicionam nenhuma funcionalidade nova nem corrigem um bug, mas melhoram a estrutura do código.

test: Este tipo de commit é feito quando são adicionados novos testes ao código existente.

chore: Usado para commits que envolvem tarefas de manutenção, como atualização de dependências ou configurações.