Skip to main content

Updating Netlify deployments when renaming your main Git branch

Posted in Development and Git

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 main (or primary or whatever you like!); just head to your site in the control panel then:

  1. Navigate to ‘Site settings’ from the main menu
  2. Choose ‘Continuous Deployment’ (inconsistent case sic) in the side menu, in the ‘Build & deploy’ grouping
  3. Scroll to ‘Deploy contexts’, the second section down the page
  4. Where you see ‘Production branch’ with the old branch name, hit the ‘Edit settings’ button
  5. 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.

Accessibility in your inbox

I send an accessibility-centric newsletter on the last day of every month, containing:

  • A roundup of the articles I’ve posted
  • A hot pick from my archives
  • Some interesting posts from around the web

I don’t collect any data on when, where or if people open the emails I send them. Your email will only be used to send you newsletters and will never be passed on. You can unsubscribe at any time.

More posts

Here are a couple more posts for you to enjoy. If that’s not enough, have a look at the full list.

  1. Getting started with NVDA

    Everyone who works in digital product development should be familiar with screen reader software. Here’s how to get started with NVDA on Windows.

  2. An enhancement to accessible responsive tables

    I’ve written about accessible responsive tables before but something has been bugging me. So here’s another step to make those tables even better.