Sign in
Log inSign up
Writing better Commit Messages!

Writing better Commit Messages!

Omkar Ghate's photo
Omkar Ghate
·Aug 16, 2021·

2 min read

What is a commit message?

Whenever you perform a commit during your development process, you are required to write a short text which describes what changes you made in that commit.

The main motive behind writing a commit message is that just by reading it, anyone will be able to clearly understand what you did in that part of your work.

Why do we need to have commit messages?

Git doesn't recommend committing without writing a commit message. Git commit messages are necessary to look back and see the changes made during a particular commit. If everyone will just commit without any message, no one would ever know what changes a developer has done. Moreover, you won't be able to track down these changes once you see the history. So, Git does not recommend this.

Committing with messages helps you know the different changes you make. It becomes even more important while working collaboratively in a team. When you commit with the messages, everybody in the team is able to look back and see the different changes made by different members.

Why is it important?

Just writing any random commit message is not enough while working on a project. When you commit with a message, you should keep few things in mind which will play a key role when someone else reads your messages. The commit message should be short, simple, yet descriptive enough, not just for you, but for everyone else as well. They should be written by keeping in mind people from all stages of the software development life cycle, be it the build team, testing team, or the deployment team. Let's look at the things you should keep in your mind while writing your commit messages.

How to write a good commit message?

Well, here are some standard commit messages that can be used. They are short, consistent, and descriptive.

  • feat - a new feature
  • fix - a bug fix
  • docs - changes in documentation
  • style - everything related to styling
  • refactor - code changes that neither fixes a bug nor adds a feature
  • test - everything related to testing
  • chore - updating build tasks, package manager configs, etc

That's it! I hope this blog gives you a basic understanding of writing good commit messages and it's significance. So, the next time you're working on a project make sure you actually use the standard commit messages mentioned above.

References:

- neog.camp/guide/lesson-two

- youtube.com/watch?v=MMEIVh49pS8&list=P…

- writingfordevelopers.substack.com/p/how-to…

end.png