Person.

Gitlab Set Main Branch as Default

I’ve started getting rid of references to master branches in all of my repositories. It’s rather easy with Gitlab, but I thought I would document the steps for anyone struggling with it.

Click Repository -> Branches:

Repository then Branches

Click New Branch and name it main:

Create main Branch

name branch main

Click Settings -> Repository:

Settings Menu

Expand Default Branch and choose main:

Selecting main branch as default

Scroll down and expand Protect Branches, protect main branch and allow Maintainers to merge and push.

Protect main branch, allow maintainers to merge and push

Click Unprotect next to the master branch:

Unprotect the master branch

Click Repository -> Branches:

Repository Branches menu

Delete “master” branch:

Delete master branch

That’s all there is to it. I am disappointed that there doesn’t seem to be a way to set this at my account level, maybe they’ll do that in the future.