Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

rename - git change default branch (gitolite)

I've got a repository with branches: master and devel. Master is the default one. I want to rename master into prod and make it default (and push it to the server). How to do this?

Repository is hosted in gitolite (if it matters).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to have access to the server in order to change the symbolic-ref of HEAD to the branch you have pushed there (prod).

git-symbolic-ref HEAD refs/head/prod

I tentatively proposed a way to do that from a client at the end of "How do I change a Git remote HEAD to point to something besides “master”", but it is easier if you can log on the server directly.

Note: with the latest Gitolite V3, you actually can run that command (see "non-core commands"):

/home/git/gitolite# gitolite symbolic-ref -h

Usage:    ssh git@host symbolic-ref <repo> <arguments to git-symbolic-ref>

allow 'git symbolic-ref' over a gitolite connection

So, through an ssh command, you actually can change HEAD for remote repos managed by gitolite (V3).

ssh git@host symbolic-ref <repo> refs/head/prod

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...