Skip to content

Enforcing Commit Message Format

Consistent commit messages help automate changelogs and simplify code reviews.

  1. Go to Settings > Repository > Push Rules.
  2. In Commit message must match this regular expression, add a pattern such as:
    ^(feat|fix|docs|style|refactor|test|chore): .+
  3. Save to enforce the rule.
  • Create a COMMIT_TEMPLATE file in the repository with the desired format.
  • Run:
    Terminal window
    git config commit.template .gitmessage
  • Developers will see the template on each commit.
  • Follow Conventional Commits for compatibility with tooling.
  • Include issue or ticket references in the footer.
  • Reject empty or generic commit messages.