Guilherme Bail

Introduction

The specification of conventional appointments is a simple and broad convention used for the writing of commits messages. It offers a set of rules that make it easier to understand what to do.

Because

Each commit in the repository concerns a fact that happened in the application. For this reason the act of committing is important to know about the past and the future of the application. Maintaining a standard for the team helps in organizing the team and prioritizing the next steps by the PO (Oroduct Owner), Tech Lead or whoever is performing this task. Maintaining a standard helps in creating tools to automate tasks, for example when creating an application CHANGELOG.

How

Bearing in mind that the team must follow a standard, there is the Conventional Commits, an international standard used by several repositories such as: Angular, Jenkins and Electron.

Below is the logic and details of how to follow the pattern.

Structure

<type> ([optional scope]): <description>

<body>

[optional footer (s)]

Types

Scope

The scope can be added to inform which application layer this commit concerns.

Scope examples:

Description

The Description contains a succinct message, following the pattern below:

Use of verbs in the present tense imperative. Ex: “change” and not “changed or” changes “

The first letter in lowercase

Do not use a period (.) At the end of the sentence

Body

As in the Description, use of imperative language in the present: “change” and not “changed or” changes “.

The body must include what and why and not how.

Baseboard

The footer should contain information about Breaking Changes, add the reference to the ticket / issue that this commit is referencing.

If it is a Breaking Change, the line must begin with BREAKING CHANGE :, the message must begin with a space or a line break.

BREAKING CHANGE: lorem ipsum

OR

BREAKING CHANGE:

lorem ipsum

For closing tickets automatically, the ticket needs to be referenced in the PR message using keywords, like:

Eg: resolves #1337

Template

A solution to always keep the pattern to be followed is to create a file called .gitmessage with the contents of the subsection Structure in the same directory as the projects, on windows the default directory can be found below:

Example

feat: database rollback

implement the database rollback in the service layer
using the default Microsoft's solution, the 
TransactionScope

Resolves #1337
fix(service): request validation 

the field 'xpto' doesn't allow special characters
for any requests

BREAKING CHANGE: all requests will pass by the validation 
and will impact the clients

References

https://www.conventionalcommits.org/

https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines

https://chris.beams.io/posts/git-commit/

https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue