Change default branch in gitlab

I accidentally pushed my local master into a branch named origin on gitlab, and now this is the default. Is there a way to rename this branch or set a new main branch to master?

+154
gitlab
Jun 22 '15 at 18:27
source share
13 answers

in GitLab Enterprise Edition 12.2.0-pre, you should use the following: Settings β†’ Repository β†’ Default branch (expand it) and change the default branch Here

+9
Aug 26 '19 at 15:37
source share

In 8.0+, it looks like this has been ported to the project. If you open your project and go to the gear icon on the right, then β€œEdit Project” you can set the default branch for the project.

+124
Jul 29 '16 at 13:36
source share

To change the default branch in GitLab:
1. Settings> General> General project settings> Expand 2. Default split> Change project default branch
3. Save changes

enter image description here

+103
Oct 03 '17 at 3:59 on
source share

To change the default branch in Gitlab 7.7.2:

  • Click "Settings" in the left pane.
  • Change the default branch to the desired branch
  • Click "Save Changes."
+53
Jun 23 '15 at 13:59 on
source share

For gitlab v10 + (as of September 2018) this has been moved to settings-> repository -> default branch

enter image description here

+51
Sep 10 '18 at 4:49
source share

In the latest version of GitLab Community Edition version 9.2.2 .:

  • You need to click the "Settings" tab located on the right of the tabs after opening the project.
  • In the "Settings" section, you will see the "Default Partition" section that will provide you with all the branches for the repository. Select the desired branch.
  • Scroll down to click the green "Save Changes" button, located only after "Project Avatar".

Please refer to the image below:

enter image description here

+13
Jun 22 '17 at 15:44
source share
  • Settings
  • General
  • General project parameters

Setting the default branch

+13
Sep 20 '17 at 9:02 on
source share

In Gitlab version v11.4.4-ee you can:

  1. customization
  2. container
  3. Default branch

Click on me

+9
Dec 14 '18 at 2:59
source share

In Gitlab CE 9.0, you can change the default branch on the Settings tab in the repository header.

+1
Apr 21 '17 at 14:02
source share

For GitLab 11.5.0-ee, go to https://gitlab.com/<username>/<project name>/settings/repository <username https://gitlab.com/<username>/<project name>/settings/repository project https://gitlab.com/<username>/<project name>/settings/repository https://gitlab.com/<username>/<project name>/settings/repository .

You should see:

Default Branch

Select the branch that you want to set as the default for this project. All merge requests and commits will be automatically sent to this branch, unless you specify another.

Click Expand, select a branch, and click Save Changes.

+1
Nov 21 '18 at 23:23
source share

Settings> Repository> Default Branch

enter image description here

+1
Aug 14 '19 at 10:19
source share

First I needed to delete on my server using ssh. If someone has a way not to do this, write.

I found my bare repositories in

 cd /var/opt/gitlab/git-data/repositories/group-name/project-name.git 

is used

 git branch 

to see the wrong active branch

 git symbolic-ref HEAD refs/heads/master 

to change the master to a branch named master, then use the web interface and "git branch" to confirm.

0
Jun 22 '15 at 19:08
source share

You must enter your project. enter image description here

Therefore, you should click "Project Settings"> "Storage". enter image description here

0
Jun 28. '19 at 7:30
source share



All Articles