iMasters.com - Knowledge for Developers.
Follow Us
Home Backend Best practices you can use when pushing your commits
Backend

Best practices you can use when pushing your commits

See in this article some good practices that you can use when pushing your commits.

This post idea is to be something quick and clear that can help you when sending your commits.

To start, I would like to ask you two questions:

-> In the last few days, have you or any member of your team sent a commit similar to: “uploading the latest version of the code”, or “now it’s time” or did you simply send “m”?

-> Have you ever needed to analyze the history of your last commits and had to go in one by one because you weren’t able to understand the purpose of each of the commits?

If you answered yes to one of these questions, you and your team need to improve the standard of your commits and to help you, I’m writing this quick post.

First, your commits need to answer the following questions:

-> Why is this change necessary? It can fix a bug, add a feature, or improve performance or security.

-> How does it solve the problem? For small or obvious changes this part can be omitted. It is a high-level description of the approach used to address the given problem.

What effects do these changes have? In addition to the obvious ones, this can include benchmarks, side effects, etc.

After answering the questions above, you can use the best practices for creating semantic commits. Below you have some of them with a brief description:

Feat: We use it when we are going to create a new feature in the project. Eg: we are creating a new endpoint in an API, or we are adding a new service within our project.

Refactor: Although the name is suggestive, it is important to reinforce its importance. We use refactor when we are updating some parts of our code.

Hot Fix: This is the one that we are afraid to use, but we ended up using it because of the rush. We use the fix to upload some corrections. Usually, some bugs that we need to fix and get up to speed quickly in production.

Chore: We use chore when we make a change that doesn’t influence our system or any of our tests. To make it more transparent, we use chore for changes like adding something inside .gitignore, this doesn’t affect our system. Or change in eslint that would be just a config.

Style: Style is used for formatting or code style changes that do not influence the system logic.

Build: This one we use when we make any changes to our project’s build.

Test: As the name implies, the test would be when we make some changes in some project tests.

Perf: This one is little known, and people end up using Fix instead because we use perf when we make some change in the performance of our project, such as: improving the performance of a function or query.

Docs: This one ends up in Chore’s change package because it doesn’t change anything or Style, but we can use Docs when we make any changes to a documentation file such as swagger, readme, etc.

Pretty simple huh? And believe me, using these good practices helps a lot in our day-to-day ?

Well, that’s it guys. I hope you liked it and I see you in the next article. ?

*The content of this article is the author’s responsibility and does not necessarily reflect the opinion of iMasters.

Written by
Thiago Adriano

Microsoft (MVP), currently works as Software Architect for TV Bandeirantes. In recent years, he has focused on technologies created by Microsoft, but he has always been on the lookout for new technologies that are emerging on the market. In short, he is passionate about what he does, he has his profession as a hobby.

Leave a comment

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Related Articles

Backend

How to Create a Skill for Amazon’s Virtual Assistant Alexa

If you didn’t know, it is not necessary for an Amazon Echo...

Backend

The APIs role in a 5G world

5G is about to revolutionize how we connect and use technology daily....

Backend

EF Core using AsNoTracking with Identity Resolution

Today we will see the consequences of using AsNoTracking with the Identity...

Backend

Understand key features added in ASP.NET Core 7.0

Version 7.0 of the .NET platform brought many new features in this...