github api to compare commits, response status is diverged

蹲街弑〆低调 提交于 2019-12-12 10:04:48

问题


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"


回答1:


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.



来源:https://stackoverflow.com/questions/23943855/github-api-to-compare-commits-response-status-is-diverged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!