commits.md

November 7, 2024 ยท View on GitHub

Commits API

Back to the navigation

Getting information on specific commits, the diffs they introduce, the files they've changed. Wrap GitHub Commit API.

List commits in a branch

$commits = $client->api('repo')->commits()->all('KnpLabs', 'php-github-api', array('sha' => 'master'));

Returns an array of commits.

List commits for a file

$commits = $client->api('repo')->commits()->all('KnpLabs', 'php-github-api', array('sha' => 'master', 'path' => 'README'));

Returns an array of commits.

Get a single commit

$commit = $client->api('repo')->commits()->show('KnpLabs', 'php-github-api', '839e5185da9434753db47959bee16642bb4f2ce4');

Returns a single commit.

Compare commits

$commit = $client->api('repo')->commits()->compare('KnpLabs', 'php-github-api', '839e5185da9434753db47959bee16642bb4f2ce4', 'b24a89060ca3f337c9b8c4fd2c929f60a5f2e33a');

Returns an array of commits.

List pull requests associated with a commit

$commit = $client->api('repo')->commits()->pulls('KnpLabs', 'php-github-api', '839e5185da9434753db47959bee16642bb4f2ce4');

Returns an array of pull requests.