A commit is one of the steps before making a Pull Request. Commit will become part of our project’s history. A good and correct commit will help other developers understand what we’re working on. A good commit follows established standards, including style, content, and metadata.
One standard we can follow is: <type>(<scope>): <message>
The <type> can include:
Where we use the commit ? base on what branch ?
Branch Type | Commit Type |
feature | feature, refactor, perf, style, test |
bugfix | fix |
hotfix | hotfix |
docs | docs |
You can found the Branch Naming and Pull Request Standardization here!
The <scope> is optional and can describe the specific page or part of the project you are working on, while the <message> summarizes what your commit does.
Example Commit Messages:
feature(dashboard): add sorting to the table
fix(atoms): button not clickable
test(component): add unit tests and made changes
In addition to the above structure, we can also add a description of the work we’ve done. For example:
docs: added and updated
[x] add select component
[x] update button styles
The above method is manual. If you prefer using extensions in VS Code, you can use commitizen, and the results will be the same.
Beyond standardization, it's important to follow best practices when making commits.
Some of these are:
By following these best practices, our work will become cleaner, more consistent, and informative, making it easier for anyone involved in the project.