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. Using iframes to embed arbitrary content is probably a bad idea

    The iframe element is a way to embed one website inside of another. Useful for things like maps or videos, but not so much for other content.

  2. Avatars and alt text

    I really enjoyed Nicolas Steenhout’s recent article on Alt text for avatars or user photos. But there is a context where I would break his rule…