标签云

微信群

扫码加入我们

WeChat QR Code

我如何将我的饭桶

We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have develop and release candidate branches as well.

I understand I can rename the master branch locally by simply using the following:

git branch -m master release

However, that is only locally. Even if I push this up to the remote, the HEAD still points to the remote master branch. I want to get rid of the master branch completely and make the default local branch upon initial clone, be release.

How can I achieve this?

EDIT: It seems that since the origin is on a gitorious server, I get errors deleting the master branch. I'm trying to see now if it is possible to change this so that the default branch is 'release'.


I must ask, is that really worth fighting the software's convention? This feels Dilbert-esque.

2018年06月19日58分30秒

Heh, fair enough. Long term worth is high enough to at least try.

2018年06月18日58分30秒

Possible duplicate of How do I rename a local Git branch?

2018年06月19日58分30秒

When I attempt git push --delete, I get the following error: deletion of the current branch prohibited

2018年06月19日58分30秒

You are using github or something similar, you need to make the default branch something else: matthew-brett.github.com/pydagogue/gh_delete_master.html or just leave master there and ignore it.

2018年06月18日58分30秒

Yeah, we have a gitorious instance. Let me see if that is an option.

2018年06月18日58分30秒

It looks like gitorious' commit hooks forbid the deletion of the master branch -- for no good reason that I can see :/

2018年06月18日58分30秒

bah! Well, then perhaps I will just have to ignore the master branch or simply use the name "master" and know that it is the release branch. I wonder if there is a way to at least tell gitorious to make the release branch a default if we went that route. I know we are eventually moving to an enterprise license for github, but not there yet.

2018年06月18日58分30秒

I can tell by these steps I will run into the same error as I mentioned above.

2018年06月19日58分30秒

KyleHayes That's a configuration issue of the server. Though it is this way by default, the process to alter that should either be apparent to the user or easily discoverable on Stackoverflow

2018年06月19日58分30秒

I got the same error as the one I posted in Adam's comment when I got to the git push origin :master command.

2018年06月19日58分30秒