What is a commit message?
Brief description of the changes you made to the codebase. So that other members of the team can understand all changes you made to the codebase.
Why is it necessary to write a good commit message?
It is a good habit to write a good commit message because people come and go but code remains there. So you should commit in such a way that future members and the member of other teams can understand What all changes you have made?
Let's see an example of the GOOD & BAD Commit message.
- Example1
- Example 2
Points to remember while writing Commit message :
Divide the commit message into 2 parts: subject and body.
In the above Example 2 1st message is subject part and 2nd message is body part.-
Mention the type of commit you are making in Subject part such as:
- Feat: For any new feature
- Fix: If you fix any bug
- Docs: Changes in documentation
- Style: Any changes in style like color, design etc.
- Refactor: When you refactor the code
- Test: Anything related to testing
- Chore: Regular code maintenance
Limit the subject line to 50 characters.
Don't end the subject line with a period (.)
-
Use the Imperative mood in subject line
Imperative mood is like giving orders. Like:
- Fix the bug
- Change background color
Wrap the body part at 72 characters.
Capitalize the subject line and each paragraph.
That's all for this blog. We will meet in the next blog until then Keep learning, Keep growing.
Connect with me :
Reference :
FreeCodeCamp
Neogcamp
Top comments (0)