DEV Community

Yan Fernandes
Yan Fernandes

Posted on • Updated on

How to use Semantic commits properly

Semantic commit messages provide a structured and standardized way of communicating the nature of changes made in a commit. By adhering to a specific format, such as the Angular convention, developers can easily understand the purpose and impact of each commit within a project's version control history. Below are examples of semantic commit messages along with their descriptions:

feat: Adding a new feature

*Add user authentication*

Adds a new middleware to handle user authentication in the system.
Enter fullscreen mode Exit fullscreen mode

fix: Fixing bugs

*Fix typo in login form*

Corrects a small typo issue in the HTML code of the login form.
Enter fullscreen mode Exit fullscreen mode

chore: Maintenance tasks

*Update project dependencies*

Updates dependency versions to the latest stable releases.
Enter fullscreen mode Exit fullscreen mode

docs: Updating documentation

*Update API documentation*

Includes additional examples and details on using the REST API in the README.
Enter fullscreen mode Exit fullscreen mode

style: Code style improvements

*Apply consistent code formatting*

Standardizes code formatting using prettier to ensure consistency.
Enter fullscreen mode Exit fullscreen mode

refactor: Code refactoring

*Refactor authentication logic*

Reorganizes code to improve readability and maintainability.
Enter fullscreen mode Exit fullscreen mode

test: Adding or modifying tests

*Add unit test for user service*

Includes a new unit test to ensure the integrity of the user service.
Enter fullscreen mode Exit fullscreen mode

build: Changes affecting the build system or external dependencies

*Update Node.js version to 14.0.0*

Updates the Node.js version to the latest available LTS version.
Enter fullscreen mode Exit fullscreen mode

ci: Changes related to configuration and continuous integration

*Set up GitHub Actions for test execution*

Defines a workflow in GitHub Actions to automate project testing.
Enter fullscreen mode Exit fullscreen mode

These examples demonstrate how semantic commit messages can provide clarity and context to the changes made in a project. While the specific keywords and formats may vary, maintaining consistency and informativeness in commit messages is essential for effective collaboration and project management.

Top comments (0)