Require merge commits into main branches to include an issue reference in the format #[number], without restricting commit messages on feature branches
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3566613. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !1285 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>Require merge commits into main branches to include an issue reference in the format <code>#[number]</code>, without restricting commit messages on feature branches.<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>We want better traceability between code changes and Drupal.org issues by ensuring that anything merged into main branches (e.g. <code>1.2.x</code>, <code>1.3.x</code>, <code>2.0.x</code>) references the relevant issue number. Today it is possible to push directly or use squash-and-merge in GitLab without any consistent issue reference, which makes it harder to audit changes, write release notes, and understand why a change was made.<br> <br><br><br> At the same time, developers should be able to work normally on feature branches and push commits with any message format during development. The requirement should apply only at the point where changes enter the main branches.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Enforce that any merge into protected main branches (e.g. <code>1.2.x</code>, <code>1.3.x</code>, <code>2.0.x</code>) contains <code>#[number]</code> somewhere in the merge commit title or message.</li> <li>Block direct pushes to protected main branches if the resulting commit message does not contain <code>#[number]</code>.</li> <li>Block squash-and-merge into protected main branches if the squash commit message does not contain <code>#[number]</code>.</li> <li>Do not enforce this rule on non-protected branches, so developers can push commits with any message format during normal development.</li> <li>Document the accepted patterns and provide example merge message wording for contributors and maintainers.</li> </ul> <p>- <strong>This issue was created with the help of AI</strong></p>
issue