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. Upgrading from iPhone 13 mini to 16 Pro

    I get a new phone every 3-ish years, give mine to my wife, and now she gives hers to our daughter. I got a 16 Pro this year! Here’s the skinny.

  2. Apple, you’re doing the Dynamic Island wrong

    I love the idea of Dynamic Island; making lemons into lemonade and all that. But, in my opinion, Apple have got the fundamentals mixed up.