How to restrict the merge request to be executed only from and to specific branches?

Viewed 648

I am trying to implement git flow with GitLab. The flow of merge requests should be restricted. For example, it should not be allowed to create a merge request from a feature branch to main.

Can I solve this with git server side hooks?

1 Answers

Considering you can require everyone to submit merge requests for a protected branch, you can try and:

  • protect the target branch
  • from the Allowed to merge list, select a group which does not include Developers.
  • from the Allowed to push list, select No one.

That way, merge request to that branch should not be possible from developers.

Related