2

When doing git flow feature start MYFEATURE I recently got the message

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

Is this use of "diverged" a git flow specific thing, or also used in git? And is one branch being an ancestor of another branch still sufficient for them to considered "diverged"? My assumption about the term "diverged" based on the English language is that both branches would have to have commits that the other branch doesn't have.

When trying to find out what "diverged" means, I came across master branch and 'origin/master' have diverged, how to 'undiverge' branches'? , but that didn't involve git flow, and involved two branches that had commits that the other branch didn't have. The term "diverged" confused a high reputation user enough that they left a comment asking for clarification.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • 1
    Two branches, one's history is A-B and the other's is A-C. This is the simplest model of two diverged branches. The graph is like a V or a Y. – ElpieKay Nov 27 '17 at 00:18
  • Seems like an unclear message. Have develop and origin/develop actually diverged in your project? If so, then `develop` could not be fast-forwarded to `origin/develop`, although perhaps it could be fast-forwarded to the last common ancestor – M.M Nov 27 '17 at 05:41

1 Answers1

3

The gitflow repo has a function which explains the different case in which "branches have diverged":

# 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

See also my older answer about diverged branches.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250