Compare Branches using GraphQL API

schema-request

#1

Hi there,

Since the last newsletter from GitHub, I have read a lot about GraphQL and we have started designing our own GraphQL API in our company. This seems really promising!

After reading the GitHub v4 Reference page, I was wondering: Is there a way to use the GraphQL API to compare two branches (like when we use GET /repos/:owner/:repo/compare/hubot:branchname...octocat:branchname) ?

Thanks!


Compare/diff two commits
#2

Hi @mlapeyre3, excited to hear that your company is using GraphQL too :slight_smile:

After reading the GitHub v4 Reference page, I was wondering: Is there a way to use the GraphQL API to compare two branches (like when we use GET /repos/:owner/:repo/compare/hubot:branchname…octocat:branchname) ?

Great question! That isn’t currently possible, but I can definitely see how that would be useful. I’m tagging this topic with schema-request so our team can take a look at this and consider this for future iterations of our v4, but I can’t make any promises of any changes. Please let me know if you have any other questions about this!


#3

Hey @francisfuzz, any news on this? :slight_smile:

I am trying to find a way to list all commits between a release and master (exactly like your link N commits to master since this release on https://github.com/user/repo/releases). Is there an alternative way to do that, if not?

Thanks!


#4

Thank you for your awesome work GitHub! We’re using implementing GraphQL at our company as well and could use a way to compare branches.


#5

@mapineda can you describe how to do that?


#6

Hi @francisfuzz,

Have you any updates on this schema-request?

Thanks !


#7

Is there rest API alternative for it as a workaround?


#8

Does someone have any news about this issue?

I’m trying to use the GraphQL API to implement some useful stuffs at my company.


#9

Yes!

api/v3/repos/:owner/:repository/compare/{base}...{head}

#10

An other bit which would be useful as part of this API or API set is the ability to know if a given commit is already part of a branch.

The v3 compare API only works on a branch-wise basis, but it can be useful to check specific commits, so plugging the v4 compare API on commits would be really nice.