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.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (2)

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!

Collapse
 
joshjms profile image
Joshua James

commit message: "minor changes"
2000 lines changed

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay