Branch Protection on multiple branches

+1 on adding support for this.

Looking more at the fnmatch documentation, it looks like there’s a File::FNM_EXTGLOB option that can be passed to enable{master,develop} to work. This option is disabled by default. Enabling it would save so much time for our organization when new feature branches are created that multiple people will work off of.


Would love this as well

Hi @jeffaburt and @trusktr,

Thanks for being here, we actually  have an internal issue discussing this possibility and I’ve added your feedback to it.  Thanks again for reaching out! I’ll come back and post any updates here.



Another +1 for getting this enabled.  

I am preparing a migration of 100+ repos to GitHub Enterprise.  The inability to automate (via REST API) branch protection rules for wildcard patterns (such as release/* and feature/*) is going to be major painpoint for us.  

1 Like

@tadms  I think the wildcard patterns support is already available and documented here:

The request still pending here is for multiple name matches such as a regex OR.   I supposed you could be looking for this?  {release/*,feature/*}   Would this also be supported?


Yes, this is possible through the UI.  But I’m not looking to manually do this 100+ times through the UI. 

My request is to have this functionality with the REST API to be able to do this programmatically (originally requested by ksraju-rms in this thread).  


Hello! @andreagriffiths11 :)

What is the current status of that feature? Where can it be discussed? It would be awesome to be able to use a pattern like {master,release/*,v[0-9]*}.


Thanks for the ping @zutatensuppe, unfortunately I don’t have any updates for you “yet”

I’d really like to be able to apply a single rule to the whole project as well no matter the branch name.

@fishercraigj  Doesn’t * work?

Not for me.  

Can’t you do this with simply * ? 

I’m looking for somethign that would let me do master OR development. Seems like such a common thing, kind of interesting that was overlooked.


Wanted to weign in myself here. Something like {master, develop} would make my life much easier as I help to manage about 28 repositories!


* worked for me in order to apply protection rule over all of existing branches

Any update on this? At least update the documentation that says github does not use fnmatch syntax. Reading the documentation, we would fully expect to use fnmatch like {master,develop} to match two branches.


So the solution that I figure out was to use


It will look for a branch named “development” 0 or more times and the same for “master”.


Greenshot 2020-04-03 18.00.15.png

My mistake was not using * at the end to match branches such as v1-ssr-mst-aptd-gcms-lcz-sty.

It matters, the rule isn’t just a prefix.

This works for me:


I’m not sure how you got this to work, but it doens’t work for me. It appears to match all the characters in the string, so any branch with an “d” in it becomes a match. I.e, development, dev-randomfeature, dev-anything

@dnorton29 wrote:

So the solution that I figure out was to use


It will look for a branch named “development” 0 or more times and the same for “master”.

In our repo we have multiple release branches: the master branch as the next branch and multiple LTS branches with the naming pattern major.minor.x like 1.3.x. We would like to enable the same protection for the master and every LTS branch. Right now we can do this only using two separate rules one with the master and the other with the *.*.x pattern. It would be great if we can provide these in one pattern, so we can manage the branch protection rules for our release branches without duplicating anything.