Git Conventions

Branch Management

sds-react-components repo is going to be divided into three main branches:

  • Master - 3.0 Version

  • 2.0 - 2.0 Version (Maintenance stage)

  • gh-pages (Used for storybook github page. Do not modify manually).

Based on the task to do, maintenance for 2.0 or new features/refactors for 3.0, developers will need to create a new branch taking as base 2.0 or master. This temporary branch is going to be a future PR that's going to be merged to the corresponding base branch.

Something else to keep in mind, is the name of the new branch created for the task. Developers have to use the ticket name as identifier and one single commit following the Commits Conventions to be described in the next section. If it is necessary to make corrections or adding more code, developers should use the command commit --amend --no-edit to overwrite the previous commit without modifying the commit name.

To push for the changes in an overwritten commit, developers need to use the command git push origin <branch_name> -f

Finally, once at least two developers have approved the changes made on the PR, the branch can be merged to its base.

Commits

To keep a better track of changes, every time a commit is done, developers need to follow the rules established by Conventional Commits.

The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

In this case, to keep it even simpler, all the optional items are going to be omitted, giving special importance just to the type of commit and its description.

Besides that, to complement the commit message, it is going to be used the Gitmoji convention, giving an extra visual hint about the commit type. Gitmoji is an initiative to standardize and explain the use of emojis on GitHub commit messages.

So, the final commit structure to use in the project will be the following one:

git commit -m "<type><gitmoji>: <description>

An example for using Gitmoji could be:

git commit -m "art: 🎨 improves made on the button component"

VS Code Extension

To help developers to generate this kind of messages, the extension Conventional Commits can be used, where developers can create the commit messages by just following steps in a wizard displayed on VS Code.

This is just an optional tool to help developers to create correct commits following the conventions stablied on this documentation.

Last updated