Prevent Compare & Pull Request for specific branches

Hi guys,

I have a private repository, I have 4 branches from main branch(A,B,C,D), I would like to protect main branch from requests of the PR from other branches.

Is it possible?

Thank you so much!

From StackExchange, answered by Eight Days of Malaise (links to GH Docs added by me):

Yes, you will want to look into the Protected Branch settings.

If others need to do their work on another branch instead of working directly off master, check the following box:

Require pull request reviews before merging
When enabled, all commits must be made to a non-protected branch and submitted via a pull request with at least one approved review and no changes requested before it can be merged into master.

The Require pull request reviews before merging rule implicitly limits pull request to non-protected branches; so it should solve your problem.