Method: Gitlab::Client::Commits#revert_commit

Defined in:
lib/gitlab/client/commits.rb

#revert_commit(project, sha, branch, options = {}) ⇒ Gitlab::ObjectifiedHash

Reverts a commit in a given branch.

Examples:

Gitlab.revert_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • sha (String)

    The commit hash or name of a repository branch or tag

  • branch (String)

    The name of the branch

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :dry_run (Boolean)

    Don’t commit any changes

Returns:


82
83
84
85
86
# File 'lib/gitlab/client/commits.rb', line 82

def revert_commit(project, sha, branch, options = {})
  options[:branch] = branch

  post("/projects/#{url_encode project}/repository/commits/#{sha}/revert", body: options)
end