How to rename the "wizard" git 'branch to' release '?

We would like to apply a new policy for our projects, so that the main branch is now called the release branch, to make sure that it is more clear how to use the branch. Naturally, we will develop and release child branches.

I understand that I can rename the main branch locally, simply using the following:

git branch -m master release 

However, this is only local. Even if I push this to the remote, HEAD still points to the remote master branch. I want to completely get rid of the main branch and make the local default branch on the initial clone, free.

How can i achieve this?

EDIT: It appears that since the source is on a critical server, I get errors deleting the main branch. I am trying to see if this can be changed so that the default branch is "release".

+58
git git-branch version-control branch
Jan 06 '12 at 18:26
source share
5 answers
 git checkout -b release master # create and switch to the release branch git push -u origin release # push the release branch to the remote and track it git branch -d master # delete local master git push --delete origin master # delete remote master git remote prune origin # delete the remote tracking branch 
+81
Jan 06 '12 at 18:37
source share

Checkout your main thread

 git checkout master 

Create your release branch and switch to it

 git branch release git checkout release 

Click on server

 git push origin release 

Delete the main branch link on the server

 git push origin :master 

Delete the local branch of the wizard

 git branch -d master 
+7
Jan 6 '12 at 18:29
source share

Ideally, you want to set up tracking, so do the following:

 git push origin HEAD:release git checkout --track origin/release 

Now do you want to delete the rest?

 git branch -d master git push origin :master 

Simple!

+1
Jan 6 '12 at 18:44
source share

As mentioned earlier, the problem here is Gitorious, which does not allow to remove the default HEAD branch. You have two options around this problem. One of them is to enter the gitorious server (with ssh), find the git repository on the file server and add:

 [receive] denyDeleteCurrent = warn 

into the configuration.

A simpler option is to simply change the default branch. Go to the repository in a great web interface, click "Edit Repository" and set "Head Change the symbolic ref HEAD to the git repository:". After that, you can delete the main branch.

+1
Jul 16 '12 at 10:00
source share

Note. This answer is for standalone git servers where you have command line access.

Since the attempt to remove the remote master from the client is really not allowed, and I believe that denyDeleteCurrent ban makes sense, I would not want to change this parameter.

However, I found that the easiest way to rename your wizard, if you have command line access on a remote server , is to run the rename command directly on the remote computer.

This worked for me:

  • SSH login to remote git server
  • Go to the xxx.git folder of your project.
  • run: git branch -m master release

Now the remote repository uses release as the default branch, and any git clone in this repository from any client by default checks the release branch.

It is also very useful after setting up a bare repository to configure it according to your needs.

0
Jan 09 '15 at
source share



All Articles