You can also read my blog post on changing the default branch stream upstream in git or renaming your own default branch in GitLab.
This post is a living post where I document all the different places where one may need to update the default branch when changing the name of that branch.
All the Places
See my previous post on updating GitLab.
If you deploy to Netlify using their standard git connection, you'll need to tell Netlify you've updated the default branch (what they call the
- Log in and find the site you just updated
- Go to
- Change the name of the production branch and click
Note: There may still be a "branch deploy" for master after you click save. You can remove this by just editing the settings one more time and removing
masterfrom the "Let me add individual branches" section.
It's possible if you use GitLab CI/CD, then a simple find/replace of
master in your
.gitlab-ci.yml will be sufficient. However, you could make your builds future proof by using environmental variables that come built-in.
For example, you may have code that says
only: refs: - master
Here, we could simply update
master to the new name, but if we also look at the updated
rules: functionality, we could refactor this to something like:
rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
This allows us to use the variables GitLab provides to explicitly say, "run this job only on the default branch." Then, our CI configuration will respect any future changes to the default branch.