Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

Please expose "git merge-base --is-ancestor" as an API

We have a use case for determining whether one commit is a descendent of another.  Our CI infrastructure evaluates a commit in a Pull Request to see if it is "broken".  This breakage may be the fault of the changes in the Pull Request itself, or it may be that the branch upon which the Pull Request was based had already been broken by someone else.  If we were to keep a database of the known breaking-commits and repairing-commits in the repository's master branch, then we could easily answer the question of whether failing CI on a Pull Request's commit was caused by the PR author.


API design suggestion:  The user's JSON request would be formatted as:

    "ancestor": "abc123",
    "descendent": "def456"

and the response would be a boolean.  Labeling the hypothesized ancestor and descendent explicitly is a less error-prone interface than the positional arguments (I can never remember the order) of the existing git command-line interface.


Today, I suppose it may be possible to call the "list commits API" twice to determine ancestry relationship, but this is wasteful both in that it's sending extra information over the wire and that two round trips are required.

1 Reply
Community Manager
Message 2 of 2

Re: Please expose "git merge-base --is-ancestor" as an API

Hi @kostmo,


Thanks for this feedback! We're always working to improve GitHub and the GitHub Community Forum, and we consider every suggestion we receive. I've logged your feature request in our internal feature request list. Though I can't guarantee anything or share a timeline for this, I can tell you that it's been shared with the appropriate teams for consideration.


Please let me know if you have any other questions.



Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!