Issues with reserved branch keywords

I would like to deploy my “dev” branch using a specific set of environment variables.

But when I try configuring a variable for the “dev” branch specifically, I am met with the following message:

dev is a reserved branch kevword (these include: production, deploy-preview, branch-deploy, dev, branch, main, master)

I’m sure there are good reasons for this limitation but wouldn’t it make sense being able publish these branches using different environment variables?

Currently all branches use the same “Branch deploys” value, which means all of them are hitting the same backend instead of their specific backend deployments.

Off the top of my head I see two solutions:

I could rename the branch, which defeats the purpose of reserving its name in the first place, since “dev” wouldn’t exist in the first place. This also means that Netlify is dictating my branching strategy which doesn’t feel right to me since it could (and does) influence many other aspects of the CI/CD pipeline.

Or I could create a dedicated Netlify site that deploys a specific branch as the production branch which defeats the purpose of having environment variables for different branches/contexts. It also means that I can’t make use of shared variables which is an awesome feature.

What is the best practice here?

Unfortunately, the best practice for your success today will indeed be not to use a branch named dev, (or one named “production”, “deploy-preview”, “branch-deploy”, or “branch”).

This is the first time I’ve heard of someone running into this and I do agree your usage is not super weird, so might I suggest filing a bug report here? Issues · netlify/cli · GitHub