Conventional commits are just a set of rules that make the versioning of a github project much easier than traditional commits. It is very easy to implement conventional commit.
But before going into conventional commit lets look into Semantic versioning. ####Semantic Versioning (SemVer): Semantic versioning is just a type of versioning that are mostly followed in many projects and it gives meaning to the versions. Semantic versioning has three components as
- X - represents MAJOR breaking changes
- Y - represents MINOR changes that affect the behaviour for the customers.
- Z - represents PATCH releases that has bug fixes and some other changes that doesn't affect behaviours.
As an example see the versions of react js here.
The steps to be followed for normal github commit can be seen here.
git commit will have a message, in conventional commit this message will have a specific format .
The structure for Conventional commit message will be
<type>[optional scope]: <description> [optional body] [optional footer(s)]
type says about the type of changes that have been made in this version.
Mostly used type will be
- feat: Add new feature to the codebase.
- fix: Fix a bug.
- test: Add test to an existing feature.
The other types will be docs, refactor, perf and chore.
- It represents the area that the changes have been made.
- If breaking change occurs, an
!can be placed at the end of the scope.
- Brief statement describing the changes.
- Gitmojis can be used at the start of the descriptions.
- If the release requires a longer description this body can be used.
- BREAKING CHANGE can be introduced either in body or footer.
- Each footer MUST consist of a word token, followed by either a
<space>#separator, followed by a string value.
- With type and description
feat: Add support for DevTools
- With optional scope
feat(lambda-article): add new article on lambda functions
- With BREAKING CHANGE as footer
feat: allow provided config object to extend other configs BREAKING CHANGE: `extends` key in config file is now used for extending other config files
- With Multiple footers:
fix: correct minor typos in code Reviewed-by: Z Refs #133
#####Relation with Conventional commit and SemVer:
fixtype will relate to PATCH release in Semantic Versioning.
feattype will relate to MINOR release.
BREAKING CHANGEwill relate to MAJOR release, regardless of type.
- Can make automatic CHANGELOG files.
- Easy to understand changes by reading commit message.
Written by Aravind P C