27 julio, 2024

Conventional commits to work as a team

You may have noticed before in programming courses or video tutorials that there are people who put an abbreviation in front of each Git message. In this post We show you where these abbreviations, called conventional commitswhat they are for and how they are used in the context of team programming.

What are conventional commits?

To understand what are conventional commits First we must know what a commit. A commit is a key element in working with the Git tool, a software designed by Linus Torvals to control versions of a project. This software It is based on the fact that a developer’s working copy also functions as a history of all changes made to the project.

The abbreviations that you have seen at the beginning of a commit They serve to know what type of commit is. These abbreviations are not a personal convention that each programmer creates. In fact, it is a very popular language when it comes to team programming called conventional commits. Under this language there are rules for how to write a message of commit and types of commit. The purpose of this language is to create a more efficient history of your changes. Instead of just having the code of the commit With the author and the date, we will have a clear text that will describe what change has occurred.

There are programs that directly generate a file for you changelog or history of changes from one version to another. These programs create a file with everything that has changed in your project based on the messages from log either commit. Using the conventional commitsthis program will be able to more easily identify what has happened between one version and another.

Your teams may initially be uncomfortable with incorporating the language of conventional commitsbut you make sure that, Before long, you’ll be grateful that you organized your change history this way.

Structure of conventional commits

The conventional commits They are structured from two basic elements. First, you write the type of commit with an abbreviation and then its description, separated by a colon. The types of conventional commits most popular are:

fix: It means that a repair was made to a bug On our website. feat: It is written when we want to say that a new function has been introduced in our code. build: represents any action that has to do with the web page construction process. ci: represents a commit with a change in the configuration of our CI files. chorus: are commits working intermediates that mean nothing and can be ignored when we generate the file changelog. docs– Represents documentation changes and file creation. style: represents a change in code writing style. For example, if you change double quotes to single quotes, you are creating a change in programming style. refactor: represents a change in the refactoring process. This process happens when we make changes to the internal structure of our software to make it easier to understand. These changes do not add features or fix bugs. perf: represents a change in the code that improves the performance of the web page and makes it go faster. test: represents a change in existing tests or the creation of new missing tests.

In addition to the description and type elements, the conventional commits They have optional elements that can help you be more specific. Between the type and the description you can add the scope of the change. Additionally, if you need to specify more things about the change you made, you can add an optional body to the message.

Finally, a conventional commit It can also have a message footer or footer. He footer The most common is BREAKING CHANGE, which means that the change made generates a break in the API. This footer It is important to tell your team that there will be incompatibility with the previous version.

To review all the conventions of this language, examples of how a message is structured commit and what it means depending on the elements you use, we recommend you go to the page conventional commits that has all the updated information.

Do you dare to continue learning?

After reading this post you are ready to work and program as a team efficiently. And what better way to put your skills to the test than a course where you share code with other programmers? For this reason, we recommend our intensive bootcamp Full Stack Web Development Bootcamp. There, in addition to learning everything necessary to be a web developer, you will be in a perfect environment for trial and error. Sign up!

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *