Updating Netlify deployments when renaming your main Git branch
When you rename your Git branch, it’s going to break any deployments you’ve got set up. That’s because they’re configured to trigger when you push changes to your old
master branch, which doesn’t exist any more.
In Netlify, it’s pretty straightforward to change the deployment branch to
primary or whatever you like!); just head to your site in the control panel then:
- Navigate to ‘Site settings’ from the main menu
- Choose ‘Continuous Deployment’ (inconsistent case sic) in the side menu, in the ‘Build & deploy’ grouping
- Scroll to ‘Deploy contexts’, the second section down the page
- Where you see ‘Production branch’ with the old branch name, hit the ‘Edit settings’ button
- Change the value ‘Production branch’ to the new branch name and save the changes
That’s it! The next time you push to your renamed branch, Netlify will publish your site.