How to write an effective Git commit message?

First published: Wednesday, April 20, 2022 | Last updated: Tuesday, March 18, 2025

A clear and descriptive Git commit message provides a better context for fellow developers, improving the software development process for the team.


A conceptual drawing illustrates a developer thinking about how to write a good Git commit message.

Crafting a compelling Git commit message is essential for effectively communicating the changes made to your source code. Think of it like writing the perfect email message with a subject and a body: it needs to be clear, concise, and informative. But why is this so important? A descriptive Git commit message not only helps you and your team understand the history of your software project but also serves as a vital reference point in the future. In this blog post, we are going to learn how to identify what a poorly written Git commit message looks like (with some examples) and how to make it better.

Identifying poor Git commit messages and potential causes

Poor Git commit messages often arise from a developer’s lack of understanding of the team’s software development process. In some cases, developers may feel too lazy to take the time to describe the code changes they made in their Git commit messages. Additionally, internal team politics can also lead to ineffective Git commit messages. While there are several reasons for these bad Git commit messages, let’s set those aside for now.

First, we must learn to identify the wrong patterns of Git commit messages with better examples. Here are major wrong patterns we need to identify and stop continuing it.

  1. Beginning the subject of your Git commit message with a small alphabetical character is a bad idea.
  2. Using past, present, and future continuous tenses in the subject of the Git commit message is not recommended.
  3. Writing a very long subject for a Git commit message is not preferred.
  4. On the whole, your Git commit message should not look like a big paragraph.
# Example referring to above point 1.
added multi-factor authentication.

# Example referring to above point 2.
Added multi-factor authentication.
Adding multi-factor authentication.

# Example referring to above point 3.
Adding multi-factor authentication feature in the app with upgraded Python packages.

# Example referring to above point 4.
Added multi-factor authentication feature in the app. Implemented QR code based TOTP generator. Integrated with the main authentication module. Included feature on/off switch for multi-factor authentication. Upgraded Python packages in the requirements.txt file.

Best ways of writing an effective Git commit message

If you have learned to identify the wrong patterns of writing a Git commit message, then you can easily understand how to make it right with the below instructions.

  1. The subject of the Git commit should begin with a capitalized alphabetical character.
  2. The subject of the Git commit message should contain a short description that references the critical source code changes.
  3. Make sure the subject of the Git commit message is described in an imperative mood.
  4. Try limiting the subject of the Git commit message from 50 to 70 characters.
  5. The body of a Git commit message is an optional thing.
  6. Use a blank line to separate the subject of the Git commit message from the body.
  7. The body of the Git commit message must have an elaborate description referring to the subject.
  8. Try wrapping the body of the Git commit message by 70 characters per line, for better readability in Linux or Unix terminals.
  9. It is good to write the body of the Git commit message concisely. If possible, use a hyphen (-) or asterisk (*) symbol to represent bullet points in the body of the Git commit message.
  10. Reference the issue or ticket identifier at the bottom of the Git commit message, if you manage source code repositories in GitHub, Bitbucket, or GitLab.
# Example referring above points.
Add multi-factor authentication

- Implemented QR code based TOTP generator.
- Integrated with the main authentication module.
- Included feature on/off switch for multi-factor authentication.
- Upgraded Python packages in the requirements.txt file.

GitHub issue: #7343

Here are the benefits of writing better Git commit messages

  1. Git commit messages to improve team productivity. In most cases, developers working in a team need clear information about the source code changes. That’s why the Git commit message needs to be clear and understandable for source code reviewers.
  2. You can easily track issues or bugs with Git commit messages. When a critical issue happens in a production environment, we need to fix the issue as soon as possible because it will affect the organization’s reputation and brand name. Hence, our Git commit message should be clearer for other team members.
  3. Better Git commit messages allow us to create better internal release notes. After implementing a new feature in a project, the developer needs to create and share internal release notes with the QA team. In release notes, the developer needs to mention bug fixes, issues, and functionalities. This is how the Git commit messages play a vital role in internal release notes.
  4. Proper Git messages allow new developers to easily adapt the flow of source code. These days people rapidly switch their jobs from one organization to another organization. When a new developer joins an organization, he needs to understand the source code flow and get started as soon as possible. A good Git commit message will smoothen the knowledge transfer process for the new developer.
  5. Precise Git commit messages are very important in open source software development. If you want to contribute to an open source project, you need to write a clear Git commit message because project maintainers, contributors, and followers are from different countries. When you push a Git commit to the repository, your commit message is open to the world, and many developers refer to the commit message to understand your contribution in a better way.

We hope you enjoyed our blog post on writing effective Git commit messages! Writing clear and meaningful messages can truly enhance your team’s software development process. If you’re interested in exploring training or solutions that delve into similar technologies—for yourself or your organization—don’t hesitate to get in touch. We’d love to help you elevate your skills!


Logo of SloopStash organization.

Upskill your tech career with realtime workplace-driven training

Cloud training

DevOps training

Code training

Operating system training


Explore training