如何在Github中将开发分支设置为默认值而不是主分区

如何在Github中将开发分支设置为默认值而不是主分区

本文介绍了如何在Github中将开发分支设置为默认值而不是主分区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可以在存储库的管理页面上完成。另一个默认分支可以在那里设置。这就是这个问题的答案。

I know this can be done on the Admin page of a repository. Another default branch can be set there. And that would be the answer of this question.

但是我发现了(也许是一个错误?)以下内容。如果你的master分支和develop分支完全一样,那么git clone不会克隆默认的develop分支,但仍然是master!如果您向开发分支提交了某些内容,请删除您的克隆并再次克隆,您将获得开发分支!

But I discovered (maybe a bug?) the following. If your master branch and develop branch are exactly the same, than a git clone will not clone the default "develop" branch, but still "master"!! If you commit something to the develop branch, remove your clone and than clone again, you will get the develop branch!

这是Git行为还是Github?这可以解决它设置它始终开发?

Is this Git behaviour or Github? And can this be fixed to set it ALWAYS to develop?

推荐答案

这是一个混帐功能



我刚用本地仓库进行了测试,而我的第一个仓库 test HEAD c>: develop

C:\Users\VonC\Documents\GitHub\test>git symbolic-ref HEAD
refs/heads/develop

...克隆在 test1 中的默认分支的名称是 master

... the name of the default branch cloned in test1 is master!

C:\Users\VonC\Documents\GitHub\test1>git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/master

请参阅之外的东西:

从克隆的回购视角来看,远程回购仓库中的 HEAD 引用了 master develop

See "How do I change a Git remote HEAD to point to something besides "master"":
From the cloned repo perspective, HEAD on the remote origin repo references both master and develop:

C:\Users\VonC\Documents\GitHub\test1>git ls-remote origin
c215dd28ea8bf9b0c6b522c784b70bbbb3e858a5        HEAD
c215dd28ea8bf9b0c6b522c784b70bbbb3e858a5        refs/heads/develop
c215dd28ea8bf9b0c6b522c784b70bbbb3e858a5        refs/heads/master

确定克隆回购的默认分支的顺序是:

And the order for determining the default branch of a cloned repo is:

这篇关于如何在Github中将开发分支设置为默认值而不是主分区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:16