Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Default branch in gitlab

Tags:

gitlab

People also ask

Can we rename master branch in GitLab?

To rename your local “master” branch on your machine, you'll just need to run a simple one liner command. This will update your local master branch but not the remote branch. Later on we also need to look at renaming the remote master branch and changing the default branch name in the git repository.

What is master branch in GitLab?

Every Git repository has an initial branch, which is the first branch to be created when a new repository is generated. Historically, the default name for this initial branch was master . This term came from Bitkeeper, a predecessor to Git.


in the GitLab Enterprise Edition 12.2.0-pre you have to use following: SettingRepositoryDefault Branch ( expand it) and change the default branch Here


In 8.0+ it looks like this was moved into 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.


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

enter image description here


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

enter image description here

As stated by @Luke this is still valid as on 4/1/2021


To change the default branch in Gitlab 7.7.2:

  • Click Settings in the left-hand bar
  • Change the Default Branch to the desired branch
  • Click Save Changes.

  1. Settings
  2. General
  3. General Project Settings

Setting the default branch


In the latest GitLab Community Edition version 9.2.2.:

  1. You have to click on 'Settings' tab located at right most on tabs panel after opening the project.
  2. Under 'Settings' you will get section 'Default Branch' dropdown which will give you all branches for the repository. Select the desired branch.
  3. Scroll down to hit green colored 'Save changes' button located just after 'Project Avatar'.

Please refer image below:

enter image description here