Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Akash Shyam
Akash Shyam

Posted on

     

Level Up Your Commit Messages With These Tips!

At some point, we’ve all come across a commit message we don’t understand. Let’s rectify that commit by commit:

1. Specify the type of comment

  • feat: for feature addition
  • fix: for bug fixes
  • refactor: for changing the way a code block is written without changing the final result
  • style: for style changes(CSS/Sass etc)
  • test: anything and everything about testing
  • docs: documentation addition/updates
  • chore: code maintenance

Do not restrict yourself to these types, feel free to add more types of comments but be consistent across the code base.

2. Never assume another developer understands the original problem i.e. the reason for the commit

I recently started working on an existing codebase along with 3 developers. Me and another dev just started working on the codebase. On the second day, when I woke up to pull the latest code to my database I see this:

fix: bug inside the StudentList screen regarding the list// … some irrelevant details about the new solution
Enter fullscreen modeExit fullscreen mode

When I looked at it, I had no idea what the problem was. After about 15 minutes of chatting back and forth, I finally understood the original problem.

Just a single paragraph, that’s all I ask. One paragraph describing the problem containing 2–3 lines. It will help you too in the future, when you come back later trying to fix a bug.

3. Limit the subject line to 50 characters

50 characters is not a hard limit, just a rule of thumb. Keeping subject lines at this length ensures that they are readable, and forces the author to think for a moment about the most concise way to explain what’s going on.

Github will truncate commit messages over 72 characters

Checkout the remaining articlehere. I've saved the best for the last!

Top comments(4)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
akashshyam profile image
Akash Shyam
Full-stack aficionado | Enhancing SaaS & indie maker products and helping them excel 🔥

Don't forget to check the remaining articlehere . It contains 4 more tips!

CollapseExpand
 
karanpratapsingh profile image
Karan Pratap Singh
A software engineer who aims to evolve, innovate, and inspire through technology.

Hey this is a great tip, I suggest adding conventional commits as wellconventionalcommits.org/en/v1.0.0/

CollapseExpand
 
akashshyam profile image
Akash Shyam
Full-stack aficionado | Enhancing SaaS & indie maker products and helping them excel 🔥

I actually have including some portions from the conventional commits page.

CollapseExpand
 
karanpratapsingh profile image
Karan Pratap Singh
A software engineer who aims to evolve, innovate, and inspire through technology.

Oh nice, thanks

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Full-stack aficionado | Enhancing SaaS & indie maker products and helping them excel 🔥
  • Location
    India
  • Joined

More fromAkash Shyam

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp