【发布时间】:2011-02-28 17:34:26
【问题描述】:
在我的项目中,我通常有一个(开发)分支通向下一个发布版本,此时开发分支将合并到发布分支中,然后会创建一个新的开发分支。
这意味着,两个分支 HEAD 将指向同一个提交:
$> cd project.git
$> rgrep release .
./packed-refs:2808f1de3e05bf7fcc509c20f31a93e2ba645bd3 refs/heads/release
$> rgrep 2808f1de3e05bf7fcc509c20f31a93e2ba645bd3 .
./packed-refs:2808f1de3e05bf7fcc509c20f31a93e2ba645bd3 refs/heads/release
./packed-refs:2808f1de3e05bf7fcc509c20f31a93e2ba645bd3 refs/heads/development_0103
我希望从我的 repo 克隆的人自动检查发布分支。
$> cd project.git
$> git symbolic-ref HEAD
refs/heads/release
但是,当从那个 repo 克隆时,显然人们会签出按字母顺序排列的第一个匹配分支
$> git clone project.git/ project.clone
$> cd project.clone
$> git status
# On branch development_0103
nothing to commit (working directory clean)
在我看来,git 正在通过查看 SHA1 来计算要检查的分支名称,但实际上并未使用遥控器的符号头 HEAD。
有什么办法可以解决这个问题并使克隆默认为“release”而不是“development_0103”?
【问题讨论】:
-
你没有使用master有什么原因吗?
-
你用的是什么版本的git?我从未见过这个。
-
jleedev:如果我将“release”重命名为“master”,则行为没有区别,因为“master”仍按字母顺序排在“development_0103”之后
-
@Andre:我继续向邮件列表报告。我还不能给你直接链接,但它会显示在这里:dir.gmane.org/gmane.comp.version-control.git
-
@Andre @Jefromi:Jefromi 帖子的链接以及答案将是:comments.gmane.org/gmane.comp.version-control.git/168144。早在 2009 年就提出了一个补丁,但尚未应用:article.gmane.org/gmane.comp.version-control.git/110049