Method: Gitlab::Client::Branches#create_branch

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

#create_branch(project, branch, ref) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_branch

Creates a repository branch. Requires Gitlab >= 6.8.x

Examples:

Gitlab.create_branch(3, 'api', 'feat/new-api')
Gitlab.repo_create_branch(5, 'master', 'develop')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • branch (String)

    The name of the new branch.

  • ref (String)

    Create branch from commit sha or existing branch

Returns:

[View source]

80
81
82
# File 'lib/gitlab/client/branches.rb', line 80

def create_branch(project, branch, ref)
  post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
end