Writing Effective GitHub Commit Messages: A Comprehensive Guide

Writing Effective GitHub Commit Messages: A Comprehensive Guide

A minor change to your commit message style can make you a better programmer

In software development, writing clear and meaningful commit messages is highly important.

Commit messages serve as a form of documentation that helps developers understand the changes made to a codebase over time.

when we do so, our investing time and effort in writing informative and concise commit messages can significantly improve code collaboration, maintainability, debugging, and overall software development processes.

It contributes to better project management, effective teamwork, and long-term code sustainability.

conventional commit specification

  1. Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by a colon and a space.

  2. The type feat MUST be used when a commit adds a new feature to your application or library.

  3. The type fix MUST be used when a commit represents a bug fix for your application. An optional scope MAY be provided after a type

    e.g., fix(parser):

  4. A description MUST immediately follow the type/scope prefix. The description is a short description of the code changes,

    e.g., fix: array parsing issue when multiple spaces were contained in a string

  5. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin with one blank line after the description.

  6. A footer MAY be provided one blank line after the body (or after the description if the body is missing). The footer SHOULD contain additional issue references about the code changes (such as the issues it fixes).

    e.g.,Fixes #13

  7. Breaking changes MUST be indicated at the very beginning of the footer or body section of a commit. A breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon and a space.

  8. A description MUST be provided after the BREAKING CHANGE: describing what has changed about the API,

    e.g., BREAKING CHANGE: environment variables now take precedence over config files.

  9. The footer MUST only contain BREAKING CHANGE, external links, issue references, and other meta information.

  10. Types other than feat and fix MAY be used in your commit messages

    Type: chore, docs, feat, fix, refactor, style, or test.

    • feat: (a new feature)

    • fix: (a bug fix)

    • docs: (changes to the documentation)

    • style: (changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)

    • refactor: (a code change that neither fixes a bug nor adds a feature)

    • test: (adding missing tests, refactoring tests; no production code change)

    • chore: (updating grunt tasks etc; no production code change)

    • BREAKING CHANGE: (introducing a breaking change in the code)

Read commit messages of this public repository https://github.com/adisreyaj/portfolio/commits/main