When developers are pushing their code to VCS(Version Control System) such as Git. If you are working in any industry for production level code.
One should learn to write better commit message and make it a habit so that it is easy for co-developers to understand the code just by seeing the commit message.
You can use git log command to check all the commit messages, I bet you will come to see βYepβ¦ I have absolutely no idea what I meant by βFix styleβ 6 months ago.β that doesnβt make any sense, what is fixed, what is the issue. π₯΄
Structure of Git commit message
Condensed
git commit -m <message>
Detailed
git commit -m <title> -m <description>
Tips for writing commit message
- Use first letter as capital and rest as lowercase (title case).
- Use type of commit message e.g. bugfix, error, refactor, bump, config.
- Commit length of body must be 50 characters and description must be at least 72 characters.
- Be specific, donβt use worked, developed, thought, rather be direct, βfixβ.
The commit type can include the following:
- feat β a new feature is introduced with the changes
- fix β a bug fix has occurred
- chore β changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies)
- refactor β refactored code that neither fixes a bug nor adds a feature
- docs β updates to documentation such as a the README or other markdown files
- style β changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so on
- test β including new or correcting previous tests
- perf β performance improvements
- ci β continuous integration related
- build β changes that affect the build system or external dependencies
- revert β reverts a previous commit
Top comments (0)