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. Images as the first thing in a button or link

    If the text of an interactive element like a button or link is preceded with an accessible image, we’ve probably got an accessibility problem.

  2. Alt text for CSS generated content

    There’s an interesting feature in Safari 17.4 that allows content added with CSS to have ‘alt’ text. I’m not sure how I feel about this.