【问题标题】:What does "diverged" mean in git or git flow terminology?在 git 或 git flow 术语中“发散”是什么意思?
【发布时间】:2017-11-26 23:20:12
【问题描述】:

最近在做git flow feature start MYFEATURE的时候收到消息

$ git flow feature start MYFEATURE
Branches 'develop' and 'origin/develop' have diverged.
And branch 'develop' may be fast-forwarded.

这种“发散”的使用是特定于 git 流的东西,还是也用于 git?一个分支是另一个分支的祖先是否仍然足以让他们认为“分歧”?我对基于英语的“分歧”一词的假设是,两个分支都必须有另一个分支没有的提交。

当试图找出“分歧”是什么意思时,我遇到了 master branch and 'origin/master' have diverged, how to 'undiverge' branches'? ,但这不涉及 git 流,并且涉及两个分支,它们具有另一个分支没有的提交。 “分歧”一词足以让高声誉用户感到困惑,以至于他们left a comment asking for clarification

【问题讨论】:

  • 两个分支,一个是A-B,另一个是A-C。这是两个分支分支的最简单模型。该图类似于 V 或 Y。
  • 似乎是一条不清楚的信息。在您的项目中,开发和起源/开发实际上是否存在分歧?如果是这样,那么develop 不能快进到origin/develop,尽管它可能会快进到最后一个共同祖先

标签: git terminology git-flow


【解决方案1】:

gitflow repo has a function 解释了“分支已经分歧”的不同情况:

# git_compare_branches()
#
# Tests whether branches and their "origin" counterparts have diverged and need
# merging first. It returns error codes to provide more detail, like so:
#
# 0    Branch heads point to the same commit
# 1    First given branch needs fast-forwarding
# 2    Second given branch needs fast-forwarding
# 3    Branch needs a real merge
# 4    There is no merge base, i.e. the branches have no common ancestors

另请参阅我的旧答案about diverged branches

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 2021-05-25
    • 2011-05-01
    • 2012-03-03
    • 1970-01-01
    • 2012-12-22
    相关资源
    最近更新 更多