Writing good Git commit messages matters!

A thread about how to write clean commit messages:

🧵 👇
1️⃣ Make your commit messages meaningful, explaining the reason for the change. The more explicit the message is, the more helpful it will be.

Examples:

❌Don't:
- fixed
- done
- added 2 class

✅Do:
- add missing validation to login form
- fix bug for calculating cart price
2️⃣ Use the imperative mood

Imperative mood means that the commit message should be written as if giving a command or instruction.

Examples:

❌Don't:
- I have implemented ...
- this commit will ...
- more fixes for broken stuff

✅Do:
- add ...
- fix ...
- remove ...
3️⃣ Use present tense

Git commits can be checked out, merged, reverted or cherry-picked.

A properly formed Git commit line should be able to complete the following sentence:

- If applied, this commit will...

In order to complete this sentence, using present tense is needed.
4️⃣ Add link reference to the actual user story, task or bug

If you use project management tools such as Jira, GitLab or Azure DevOps then you can add the reference-id to the actual working item.

Template:
#<item-id>:<message>

Example:
#d342da: Fix bug on client validation
5️⃣ Commit length:

Most of the time if you have long commit messages it means that you violate the following principle:

- Commit early & commit often

If you take baby steps and commit your work frequently, then you won't have issues with the commit length.
✅ Tips for writing clean commit messages (sum up):

- make your commit messages meaningful, explaining the reason for the change
- use the imperative mood
- use present tense
- add link reference to the actual user story, task or bug
- commit early & commit often

Enjoy! 🙏❤️

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Deni Moka⚡

Deni Moka⚡ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @dmokafa

16 Nov 20
You always wanted to use Test Driven Development (TDD) but you don't know where to start?

Here is a thread for you about TDD in practice.

🧵 👇
1️⃣ Familiarize yourself with the three laws of TDD

These rules are the fundamentals of using TDD in practice. They constrain us to change only one thing at a time. They force us to apply babysteps!

Memorize and strictly follow these rules in order to use TDD efficiently!
2️⃣ Get started with coding Kata exercises

Katas are small programming exercises focusing on small problems.

Solving Kata exercises is a great way to deepen the fundamentals of TDD.

Pick a Kata exercise! You can find many of them here: codingdojo.org/kata
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!