Gitlab::Client::Branch
Defines methods related to branch.
Instance methods
Get single branch in a project.
- param [Int32] project_id The ID of a project.
- param [String] branch The name of a branch.
- return [JSON::Any] Information about the branch in a project.
client.branch(1, "master")
Gets a list of branches in a project.
- param [Int32] project_id The ID of a project.
- param [Hash] params A customizable set of params.
- option params [String] :page The page number.
- option params [String] :per_page The number of results per page. default is 20
- return [JSON::Any] List of branches under a project.
client.branches(1)
client.branches(1, {"per_page" => "10"})
Create branch in a project.
- param [Int32] project_id The ID of a project.
- param [String] branch The name of a branch.
- param [String] ref The branch name or commit SHA to create branch from.
- return [JSON::Any] Information about the created branch in a project.
client.create_branch(1, "develop", "master")
client.create_branch(1, "hotfix/xxx", "9dff773")
Delete a branch.
- param [Int32] project_id The ID of a project
- param [String] branch The name of a branch.
- return [JSON::Any] Information about the deleted branch.
client.delete_branch(4, 2)
Protect branch in a project.
- param [Int32] project_id The ID of a project.
- param [String] branch The name of a branch.
- param [String] ref The branch name or commit SHA to create branch from.
- return [JSON::Any] Information about protected branch in a project
client.branch(1, "master")
client.protect_branch(5, 'api', { "developers_can_push" => "true" })