Change Default branch in gitlab

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

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

回答1:

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.



回答2:

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.


回答3:

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



回答4:

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:



回答5:

  1. Settings
  2. General
  3. General Project Settings



回答6:

In Gitlab CE 9.0, You can change the default branch from the Settings Tab in a repository's header.



回答7:

First I needed to remote into my server with ssh. If someone has a non ssh way of doing this please post.

I found my bare repositories at

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

used

git branch  

to see the wrong active branch

git symbolic-ref HEAD refs/heads/master 

to change the master to to be the branch called master then use the web interface and "git branch" to confirm.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!