DEV Community

Maciej Wakuła
Maciej Wakuła

Posted on

Git commit messages

Hints for writing git commit messages.

  • commit message has a header, then optional empty line followed by longer description
    • header is a 1-line abstract summary
    • header can start with a prefix, ex. "fix:", "feat:", "BREAKING" - see https://conventionalcommits.org
    • keep it short, avoid plural, "the", "an", dot, etc.
    • examples: "add lib X", "fix #123", "add default cfg"
    • longer description can be added after an empty separator line - use it to provide details for whoever might need to check this commitin the future, link to tickets, features, links, files
  • use git log --oneline to show only the commit headers
  • as long as it is on your local branch - use rebase to keep your commits on the top of other changes
  • after someone might have used it (ex. you merged it to develop), avoid rebase

Top comments (0)