At some point, we’ve all come across a commit message we don’t understand. Let’s rectify that commit by commit:
- 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.
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
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.
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 article here. I've saved the best for the last!