Commit Message
Syntax
Valid commit messages have the structure:
**[variable]**
are required variables that must be replaced in a final commit message (**[]**
symbols must be removed)- // Comment are comments that must be removed in a final commit message
Rules
The following rules must be met for a commit message to be valid:
-
**[product/sub-product]**
variable depends on the changes in your commit.The major products are as follows:
In addition to these, some products have a specific subset of sub-product possibilities to use. If the commit only changes files related to one of them, you are encouraged to use a specific sub-product pipeline.
This is a list of each available sub-product:
- Integrates: front, forces, retrieves.
- Skims: cspm, sast, dast, apk.
- Observes: code-etl, gitlab-etl, infra.
If you are working on a file in the root of the repository, outside all of these folders, use
common
. -
**[type]**
variable has to be one of the following: -
**[scope]**
variable has to be one of the following: -
A Commit title must exist.
-
A Commit title must not contain the ’:’ character.
-
Commit title must have 60 characters or less.
-
Commit title must be lower case.
-
Commit title must not finish with a dot ’.‘.
-
Commit title must reference an issue.
-
Commit title must be meaningful. Avoid using things like
feat(build)[integrates]: #5 feature
. -
If commit title has sol type, it must reference issue #0.
-
A blank line between commit title and commit body must exist.
-
A commit body must exist.
-
Lines in commit body must have 72 characters or less.
Possible combinations
Below is a table explaining all the possible combinations between types and scopes for a commit message (Types are columns, scopes are rows):
rever | feat | perf | fix | refac | test | style | |
---|---|---|---|---|---|---|---|
front | Revert front-end to a previous version | Add new feature to front-end | Improve perf in front-end | Fix something in front-end | Change something in front-end | Add tests for front-end | Change front-end code style |
back | Revert back-end to a previous version | Add new feature to back-end | Improve perf in back-end | Fix something in back-end | Change something in back-end | Add tests for back-end | Change back-end code style |
infra | Revert infra to a previous version | Add new feature to infra | Improve perf in infra | Fix something in infra | Change something in infra | Add tests for infra | Change infra code style |
conf | Revert config files to previous a version | Add new feature to config files | NA | Fix something in config files | Change something in config files | NA | Change config files code style |
build | Revert building tools to previous a version | Add new feature to building tools or add a new building tool | Improve building perf | Fix something in building tools | Change something in building tools | Add tests for building tools | Change building tools code style |
job | Revert jobs to previous a version | Add new feature to jobs or add a new job | Improve jobs perf | Fix something in jobs | Change something in jobs | Add tests for jobs | Change jobs code style |
cross | Revert several scopes to previous a version | Add new feature for several scopes | Improve perf in several system parts | Fix something in several system parts | Change something in several system parts | Add tests for several system parts | Change code style in several system parts |
doc | Revert doc to a previous version | Add new doc | NA | Fix something in doc | Change something in doc | NA | Change doc style |
Where:
- perf is performance.
- infra is infrastructure.
- config is configuration.
- doc is documentation.
- NA is not applicable.
Recommendations
-
Try to itemize your commit body:
Example
Here is an example of a compliant commit message:
Merge requests
Differences with commit messages
Merge Request commits are like commit messages with only three differences:
-
Merge Request
[type]
has to be the most relevant type of all its commits. The relevance list is:Where
revert
has the highest andsol
the lowest relevance.For example, if your MR has one
feat
, onetest
and onestyle
commit, the[type]
of your MR must befeat
. -
They can (not mandatory) implement a
Closes #{issue-number}
in their footer, which triggers the automatic closing of the referenced issue once the MR gets accepted
Merge Request example
Here is an example of a compliant Merge Request Message:
Issue number 13
will be automatically closed
once this MR is accepted
due to the Closes #13
footer.
ETA Merge Request messages
When your Merge Request is related to one area/issue that has an enumerable universe, i.e, we know with considerable certainty how many MRs are necessary to complete it, then you should use the following ETA model as a Merge Request message:
**[parts]**
should be replaced for
the aspect that allows to
quantify the progress of the area,
which can be a number of issues,
cases, files, tasks, etc.
**[time unit]**
should be replaced for
an appropriate unit of time
that will be used to estimate an ETA,
for example days or weeks.
**B**
is the units of time that has passed
since you started addressing
the issues of the area,
**A**
is the total number of **[parts]**
that have been submitted in such **B**
time
and **C**
is the total number of **[parts]**
that we know will resolve the issues of the area.
ETA Merge Request message example: