Konubinix' opinionated web of thoughts

How to Write a Git Commit Message?

Fleeting

How to Write a Git Commit Message

Commit messages matter

https://chris.beams.io/posts/git-commit/

best way to communicate context about a change to fellow developers

https://chris.beams.io/posts/git-commit/

, a commit message shows whether a developer is a good collaborator

https://chris.beams.io/posts/git-commit/

There is a vicious cycle here: because the commit history is unstructured and inconsistent, one doesn’t spend much time using or taking care of it. And because it doesn’t get used or taken care of, it remains unstructured and inconsistent

https://chris.beams.io/posts/git-commit/

Understanding why something happened months or years ago becomes not only possible but efficient

https://chris.beams.io/posts/git-commit/

In order to create a useful revision history, teams should first agree on a commit message convention that defines at least the following three things:

https://chris.beams.io/posts/git-commit/

Style. Markup syntax, wrap margins, grammar, capitalization, punctuation. Spell these things out, remove the guesswork, and make it all as simple as possible. The end result will be a remarkably consistent log that’s not only a pleasure to read but that actually does get read on a regular basis.Content. What kind of information should the body of the commit message (if any) contain? What should it not contain?Metadata. How should issue tracking IDs, pull request numbers, etc. be referenced?

https://chris.beams.io/posts/git-commit/

The seven rules of a great Git commit messageKeep in mind: This has all been said before.Separate subject from body with a blank lineLimit the subject line to 50 charactersCapitalize the subject lineDo not end the subject line with a periodUse the imperative mood in the subject lineWrap the body at 72 charactersUse the body to explain what and why vs. how

https://chris.beams.io/posts/git-commit/

not every commit requires both a subject and a body

https://chris.beams.io/posts/git-commit/

when a commit merits a bit of explanation and context, you need to write a body

https://chris.beams.io/posts/git-commit/

There are a number of other contexts in Git where the distinction between subject line and body kicks in—but none of them work properly without the blank line in between.2. Limit

https://chris.beams.io/posts/git-commit/

50 characters is not a hard limit, just a rule of thumb

https://chris.beams.io/posts/git-commit/

So shoot for 50 characters, but consider 72 the hard limit.3.

https://chris.beams.io/posts/git-commit/

A properly formed Git commit subject line should always be able to complete the following sentence:If applied, this commit will your subject line here

https://chris.beams.io/posts/git-commit/

Remember: Use of the imperative is important only in the subject line. You can relax this restriction when you’re writing the body.6. Wrap the bo

https://chris.beams.io/posts/git-commit/

Use the body to explain what and why vs. how

https://chris.beams.io/posts/git-commit/