10 tips for a better commit messages writing
London, UK Одесса 65000
+44 (20) 8068-5324
Branding
Startups
Wow sites
Web development
Ukraine is a capital of great people!
Please, support Ukrainian suppliers and army

10 tips for a better Git commit message

12.01.2018 10624 4 min.

The web is full of information related to different fields of programming, such as rules for comments writing, classes naming, patterns usage, etc. But not really much about the commit messages writing.

However, you’re already writing decent commit messages. And here are the 10 major rules to follow if you want to level up them to awesome:

  1. Make the titles always imperative, it should continue the phrase “this commit was made to…”.
  2. Use present time in your messages.
  3. Remove unnecessary punctuation marks.
  4. Use small case (not consistent with Git commands but looks better).
  5. Place everything in one row.
  6. Make a single commit for a single change (even really small).
  7. Point out the path to the file, if it’s not obvious which one has been changed by the commit.
  8. Never use dates, names and other inappropriate marks.
  9. Consider your team to define the unified style for commit messages and always follow it.
  10. Specify the type of commit, as it provides useful context about rest of its title:
  • 'feature' — for the new feature adding to a particular level of an application;
  • fix' — for a serious bug fixing;
  • 'style' — for styling changes and formatting fixes;
  • 'refactor' — for refactoring the code of an application;
  • 'test' — for everything related to testing;
  • 'docs' — for everything related to documentation;
  • 'chore' — for regular code maintenance.

Every commit is important. So in Solar Digital we’ve also got a good tradition to use a correspondent emoji to point out the type of each commit.

Git commit message

Emoji works like a flag to ease the understanding of what the specific commit stands for:? for a bug, ?for a disapproved smth, etc. There are various lists of suitable emojis on Github which could be used here.

Having a story in your Git log will make a huge difference in how you and others perceive your project. By taking great care in commit messages, as you do in your code, you will help to increase overall quality. Basically, the most important thing about commit message is being meaningful. Just remember, that when problems appear with a code, the right commit should be easily found — with no pain and in the shortest time.

You might also like:
  1. Code reviews can hurt. How to avoid the sharp angles in the discussion — How to overcome the common etiquette breaches in code reviews
  2. Technical debt can be a large trouble if you don’t pay it in time. What’s that — Technical debt. What are my obligations?
  3. Can you make prototypes faster than anyone? With the new tool, it’s possible — The future of rapid prototyping with the Studio tool

Let's talk

about your project

Attach file

.pdf .page .numbers .xls .xlsx .doc .docx .jpg .jpeg .png .rar .zip .7z - 3 MB

Format: pdf, page, numbers, xls, xlsx, doc, docx, png, jpg, jpeg, rar, zip, 7z; File size up to 20MB

Empty name
Empty size
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Form successfully sent :)

Oops! Something went wrong.

Play
Showreel preview
Thank you for your request!
We've received your application. Soon we'll contact you.
Oops!
Something went wrong.