How to Write Useful Git Commit Messages

Fixed Something.

Ion Utale
3 min readSep 30, 2023

Git commit messages are like tiny love letters to your future self. They should be clear, concise, and informative. They should tell you what you changed, why you changed it, and how to revert the change if something goes wrong.

But writing useful commit messages is not always easy. It can be tempting to just write “Fixed something” or “Made some changes.” But these messages are useless. They don’t tell you anything about what you actually changed or why.

So how do you write useful commit messages? Here are a few tips:

  1. Start with a clear and concise subject line. The subject line should summarize the main change that you made in the commit. It should be no more than 50 characters long.
  2. Provide a detailed description of the change in the body of the commit message. The body of the commit message should explain what you changed, why you changed it, and how it works. It should be as specific as possible.
  3. Use the imperative mood. The imperative mood is a verb tense that tells the reader what to do. For example, “Add support for new database” instead of “Added support for new database.”
  4. Use past tense. Commit messages should be written in the past tense…

--

--