class Github::Repos::Commits

Constants

VALID_COMMITS_OPTIONS

Public Instance Methods

all(*args)
Alias for: list
compare(*args) click to toggle source

Compares two commits

Examples

github = Github.new
github.repos.commits.compare
  'user-name',
  'repo-name',
  'v0.4.8',
  'master'
# File lib/github_api/repos/commits.rb, line 61
def compare(*args)
  arguments(args, :required => [:user, :repo, :base, :head])
  params = arguments.params

  get_request("/repos/#{user}/#{repo}/compare/#{base}...#{head}", params)
end
find(*args)
Alias for: get
get(*args) click to toggle source

Gets a single commit

Examples

github = Github.new
github.repos.commits.get 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
# File lib/github_api/repos/commits.rb, line 43
def get(*args)
  arguments(args, :required => [:user, :repo, :sha])
  params = arguments.params

  get_request("/repos/#{user}/#{repo}/commits/#{sha}", params)
end
Also aliased as: find
list(*args) { |el| ... } click to toggle source

List commits on a repository

Parameters

  • :sha Optional string. Sha or branch to start listing commits from.

  • :path Optional string. Only commits containing this file path will be returned.

  • :author GitHub login, name, or email by which to filter by commit author.

Examples

github = Github.new
github.repos.commits.list 'user-name', 'repo-name', :sha => '...'
github.repos.commits.list 'user-name', 'repo-name', :sha => '...' { |commit| ... }
# File lib/github_api/repos/commits.rb, line 25
def list(*args)
  arguments(args, :required => [:user, :repo]) do
    sift VALID_COMMITS_OPTIONS
  end
  params = arguments.params

  response = get_request("/repos/#{user}/#{repo}/commits", params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all