DEV Community

Cover image for Git: Commit Messages
Kenny Jinhiro
Kenny Jinhiro

Posted on

Git: Commit Messages

TLDR: Start with a word that describes the whole code change. Then, make a 4-to-5 word sentence describing the whole code change.

Recommended Examples:

  • Feat: Login
  • Fix: iOS 16.0 Crash

With these examples, you generally know what goes on. Points of reasons are given below.

1. First Word Matters

A word that could describe the whole code change makes anyone generally know what goes on in your code.

These are the words that are conventionally used.

1. Feat
New feature is being launched by the code change.

2. Fix
A fix is done in the code change.

3. Test
A test is added in the code change.

4. Chore
A package is modified (added or removed) in the code.

2. Commit Message

4 or 5 words that could generalize the code changes is absolutely recommended. Less words? Better!

Developers appreciate simplicity, look at these two examples:

  1. Test: Add new unit tests for user authenticating login functionality.
  2. Test: Added login tests

Well, in the end, these guidelines aren't a must, but simpler description would make everyone happy.

Top comments (1)

Collapse
 
king_triton profile image
King Triton

Great insights! As someone who's had to dive into countless code repositories, I can fully appreciate the value of clear and concise commit messages. These suggestions are spot on, especially the emphasis on the first word – it really sets the tone for what to expect in the change. Simple and effective communication can save so much time and confusion. Thanks for reminding us how impactful a well-crafted commit message can be!