Method: Gitlab::Client::RepositoryFiles#edit_file

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

#edit_file(project, path, branch, content, commit_message) ⇒ Gitlab::ObjectifiedHash

Edits an existing repository file.

Examples:

Gitlab.edit_file(42, "path", "branch", "content", "commit message")

Parameters:

  • project (Integer)

    The ID of a project.

  • full (String)

    path to new file.

  • the (String)

    name of the branch.

  • file (String)

    content.

  • commit (String)

    message.

Returns:



53
54
55
56
57
58
59
# File 'lib/gitlab/client/repository_files.rb', line 53

def edit_file(project, path, branch, content, commit_message)
  put("/projects/#{project}/repository/files", body: {
    file_path: path,
    branch_name: branch,
    commit_message: commit_message,
  }.merge(encoded_content_attributes(content)))
end