Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github api to compare commits, response status is diverged

When configuring jenkins, I want to detect feature branches whether they have merging conflicts, so I use github api v3 to test on 2 intentional conflicted branches.

After merge branch1 to master, I compared branch2(b2) like this:

curl -i https://api.github.com/repos/hao1987/myself/compare/hao1987:master...hao1987:b2

and it returns a long json which has an attribute:

"status": "diverged"

I wonder if that means conflict, and where I can try types of "status"

like image 418
Hao Huang Avatar asked Dec 22 '25 04:12

Hao Huang


1 Answers

This isn't documented (sorry!), but status can be one of four things:

  • "diverged" = commits were introduced on both the head and base branch since the common ancestor
  • "ahead" = commits were introduced on head after the common ancestor with base
  • "behind" = commits were introduced on base after the common ancestor with head
  • "identical" = branches point to same commit

So, "diverged" doesn't tell you whether a merge between the branches would result in merge conflicts.

like image 191
Ivan Zuzak Avatar answered Dec 24 '25 10:12

Ivan Zuzak