Skip to content

Enforce commit messages reference GitHub issue (#<num>) via pre-commit #34

@sugan0tech

Description

@sugan0tech

Summary

  • Add a commit-msg hook to require a GitHub issue reference like #123 in commit messages (subject or body).

Rationale

  • Branch naming already encodes the issue ID, but requiring a reference in the commit message improves traceability in logs and when squash-merging.
  • Keeps Conventional Commits via Commitizen while nudging contributors to add a footer (e.g., ‘Refs #’ or ‘Closes #’).

Scope

  • Add a local pre-commit commit-msg hook that checks for /#[0-9]+/ in the commit message.
  • Exempt merge and release commits.
  • Document the rule in CONTRIBUTING.md.

Acceptance Criteria

  • Commits without # (except allowed exemptions) fail locally.
  • Docs mention the requirement and show examples.
  • PR merges leave no broken commit flows.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions