Writing clear and descriptive commit messages is an important part of the software development process. Good commit messages can help you and your team members better understand the changes made to the codebase, and can also serve as a useful reference for future development work. Here are some golden rules to follow when your commit messages like a f****** boss:
Specify the type of commit: At the beginning of the commit, specify the type of change you are doing to easily understand what the commit is about. Every project can use their own conventions, but these works for me.
- feat: The new feature being added to a particular application
- fix: A bug fix
- style: Feature and updates related to styling
- refactor: Refactoring a specific section of the codebase
- test: Everything related to testing
- docs: Everything related to documentation
- chore: Regular code maintenance
Keep it concise: Your commit message should be brief and to the point. It should summarize the change made in the commit, but not be too lengthy.
Use the imperative mood: Use the imperative mood in your commit message, which means writing in the present tense and using action verbs. For example, "Fix the bug" instead of "Fixed the bug".
If needed, provide more detail in the body: To be completely honest, I do not do this so much, but I really do it when doing some kind of squash or a final final final final commit (you know what I mean). In this body I include why the change was necessary, any trade-offs made, and any other relevant information.
Be consistent: Use a consistent style and format for your commit messages throughout the project. This can help make them easier to read and understand.
If you follow these practices, your teammates will deeply love you, and you will show that are not the regular coder, but an exceptional one.
Top comments (0)