check mergeability of two branches using the github api without creating a PR

Viewed 609
1 Answers

You can try and use the GitHub API compare commits (which can be used for branches), as I illustrated here.

That will give you a status:

  "status": "behind",
  "ahead_by": 1,
  "behind_by": 2,

If you see only ahead: the branch will be easily mergeable (fast-forward).
If you see both ahead and behind... there might be conflict, but it is harder to be sure.

Related