Writing good commit messages is important so that your project history is readable, easily scannable, and understandable by anyone participating in the project.
This is the basic syntax of conventional commits:
<commit-type>: <commit-description>
<commit-type>[optional scope]: <commit-description>
[optional body]
[optional footer(s)]
- feat: Features, used when a new feature is added
- fix: Bug Fixes, used when the commit represents the bug fix in your application
- perf: Performance Improvements, used when the commit represents the bug fix in your application
- docs: Performance Improvements, used when the commit represents the bug fix in your application
- refactor: Code Refactoring, A change in code that does not fix a bug or add a feature but changes names of variables, functions, etc
- build: Builds, Changes that affect the build system or external dependencies, for example adding or removing a dependency
- style: Styles, Changes in the formatting code, tabs, spaces or semicolons, etc; They do not affect the performance of the code
- test: Tests, Adding missing tests or correcting existing tests
- revert: Reverts, Reverts a previous commit
BREAKING CHANGES: or !
Indicates that a change made to the code is a significant break or change that may affect compatibility with earlier versions of the software. Which means that additional actions are required by users or developers to adapt to the new version of the software.
This example uses the slightly advanced syntax of conventional commits
feat: agregar nueva funcionalidad de autenticación
BREAKING CHANGE: se ha cambiado el formato de los tokens de autenticación. Los tokens ahora son JWT en lugar de tokens de sesión. Esto requiere que los usuarios actualicen sus implementaciones de autenticación para utilizar el nuevo formato de token.
First there is a feat indicating that a new functionality was created, then it indicates that a BREAKING CHANGE was made and a description of the change is given
This example uses the basic syntax of conventional commits
BREAKING CHANGE:feat:: agregar nueva funcionalidad de autenticación, cambiando los tokens de sesion por JWT.
or
!feat:: agregar nueva funcionalidad de autenticación, cambiando los tokens de sesion por JWT.
Here we have two different ways of saying that there was a breaking change in the code.
First there is a BREAKING CHANGE indicating that a significant change was made to the code, then it indicates what type of changes were made in that commit, and lastly a description of the change is given