Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Question from my comment here: How to check mergeability of a branches using the github api

Is it possible to check the mergeability of two branches using the github API without making a PR? I dont want to trigger anything by creating a PR, even if I immediately delete the PR afterwards.

like image 686
Alex Yurkowski Avatar asked Nov 27 '17 02:11

Alex Yurkowski


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.

like image 132
VonC Avatar answered Sep 30 '22 07:09

VonC