Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get commit changed files & patch using github API v4 graphQL

In the Rest v3, I could easily query a commit and get the changed files and patch for each file: https://developer.github.com/v3/repos/commits/#get-a-single-commit

I don't seem to be able to retrieve this info using the new v4 graphQL, does anyone have a clue how?

like image 932
shaharsol Avatar asked Sep 23 '19 08:09

shaharsol


People also ask

What files changed in a git commit?

To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.

How do I commit all changed files?

Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.

How do I see files in a commit?

Solution. 2.1 git log to display all the commit_id, the first one is the last commit_id, copy it. 2.2 git show commit_id --name-only to display all the files committed in the specified commit_id. 2.3 Undo the last commit with git reset --soft HEAD~1 , move the mistakenly committed files back to the staging area.


1 Answers

Currently, it seems that the functionality you are looking for, and much needed in my opinion, isn't supported with GitHub's GraphQL API v4 and it's probably best to stick with the current REST API.

You can refer to the following posts on the official GitHub API support forum and the answers given there by GitHub's staff.

ref1 - 29/5/19

ref2 - 5/11/18

Also, a similar question was posted on SO here

like image 192
bentz123 Avatar answered Sep 24 '22 19:09

bentz123