Branch-specific Push Rules

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Problem to solve

Apply push rules to specific branches.

Intended users

  • Parker (Product Manager)
  • Sasha (Software Developer)

Further details

As a developer, I can push commit messages to certain branches under one (more relaxed) set of rules. But, when I commit to other branches, like integration branches (master, or ones I specify), my commit messages will be examined against a different set of rules.

Branch-specific rules would allow me to move quickly on my feature branches, but apply rigidity to the important master branch.

Proposal

My guess is that this would involve quite a bit of effort. It could be done a couple of ways:

  • making the interface for current push rules (probably not all of them, just ones that make sense for specific brances) take a branch name and allow you to create a set of rules below it. From a UI perspective this would look a lot like how one creates Deploy tokens or adds branch protections.
  • allowing the customer to build pre-receive hoooks similar to GitHub, but on gitlab.com, and of course in a safe way. (you can already do this if you run your own servers)

Links / references

  • Salesforce
    • https://gitlab.my.salesforce.com/0016100001TCxI2
    • https://gitlab.my.salesforce.com/0016100000UL5PBAA1
  • Zendesk
    • https://gitlab.zendesk.com/agent/tickets/110219
    • https://gitlab.zendesk.com/agent/tickets/15244
    • https://gitlab.zendesk.com/agent/tickets/84134
    • https://gitlab.zendesk.com/agent/tickets/196512
  • Forum
    • https://forum.gitlab.com/t/push-rules/24993
    • https://forum.gitlab.com/t/push-rule-for-specific-branch-es-only/24890
Edited Aug 12, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading