Create main branch, set as default, delete master

What I’m trying to do:

I want to have my default branch be called main and not master.

What I’ve tried and what’s not working:

Bring up the Version Control area, make a new branch called main, ensure main is selected for editing, right click and select to delete master. The following error appears:

“Cannot delete branch master - it is referenced from one or more environments.”

I found the feature request for having main be the default as Github has, or having it be at least possible to switch to main and delete master, however there’s been no update to that FR.

Given the error message, I thought there might now be a setting somewhere to change this “reference” in some “environment” options, thus making the delete possible.

Thanks

I think it’s impossible to rename or delete master.

In some apps I have created my own branches with my own names and left master there, in one of the first commits.

I already mentioned this when the new git management system was deployed:

1 Like

Here’s the docs on changing what branch your environments link to:

In my quick testing, I’m able to delete branch master without an error (with or without fiddling with the environments)–but only seemingly. When I refresh the browser tab, the master branch reappears.

As far as I can tell, you’ll be able to use main and just ignore the vestigial master branch. But the “Merge changes into master” button will still be there.

(By the way, welcome to the forum!)

1 Like

Thanks. I didn’t think to look under Publish because the button kind of implies to me an operation that, while it may have options, performs an action just once. I was expecting the creation and modification of environments to be under the settings.

I’ve changed my branch to main and will ignore master. Hopefully it can be deleted in the future!

I only discovered Anvil this week, and I already have an app that I have been wanting to do working, in a functional state, and fairly far along. I’ve been looking for this exact kind of technology for YEARS. The last thing that came close IMO was the Ares project from Enyo/webOS, and that was still JS as opposed to Python.

Super excited to be here!

2 Likes