简体   繁体   English

如何重命名分支并删除GitHub上的“旧”主分支?

[英]How to rename a branch and delete the “old” master branch on GitHub?

On my Github Repo https://github.com/mainzed/labelingsystem-server/branches there are two branches. 在我的Github Repo https://github.com/mainzed/labelingsystem-server/branches上 ,有两个分支。 The default branch "rdf4j" is the correct one. 默认分支“ rdf4j”是正确的分支。 The stale branch "master" can be deleted. 过时的分支“ master”可以删除。

How can I safely delete the "master" branch and rename "rdf4j" to "master"? 如何安全删除“ master”分支并将“ rdf4j”重命名为“ master”?

git checkout rdf4j
git branch -D master # delete old master
git branch -m rdf4j master # rename to master
git push origin +master :rdf4j # force-push the new master and delete remote rdf4j

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM