This will result in the loss of the refactoring as well. In that case, we need to roll back the production code to the previous. Let’s say the bug fix created some other bugs. If we commit two changes together, for example, a bug fix and a minor refactoring, it might not cause a very long commit message, but it can cause some other problems. In other words: we don’t want to commit a change that changes too much. If the commit consists of multiple changes that make the message too long or inefficient, it’s good practice to separate it into several commits. Our commits should be reasonably small and atomic. Atomic CommitsĪlthough using a proper style is a good practice, it’s not enough. Let’s explore some things we should keep in mind when creating commit messages. It should be just enough, and not too detailed.It should be understandable even by seeing only the header of the message (we’ll talk about the header soon).The perfect commit message should have certain qualities: Like in so many other things, being consistent in our commit message produces compound results over time. The trick is to pick the best style that suits the team and the project and then stick to it. Good commit messages can be written in many different styles. Instead, we should provide proper commit messages for people to use as a resource in their daily work. It’s not a good idea to think that if it’s not clear for others, they can ask us about it. If we fix a bug or add a feature we will probably completely forget about it a month or two later. If we have a task to add some logic to some part of the code, previous good commit messages can help us find out where and how to add the code. The proper commit message can save a great deal of time finding the recent changes related to a bug.īeing a new member of a team and working on projects we haven’t seen before has its challenges. To find out what caused the problem, reading the commit messages could be handy. Let’s say there’s a bug in the application which was not there before. Why Is a Good Commit Message Important?Ĭommit messages are a way of communication between team members. Writing meaningful commit messages can save a lot of time answering many “why?” and “how?” questions, and thus gives us more time in the day to do productive work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |