问题
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