Method: Rugged::Repository#create_branch

Defined in:
lib/rugged/repository.rb

#create_branch(name, sha_or_ref = "HEAD") ⇒ Object

Create a new branch in the repository

name - The name of the branch (without a full reference path) sha_or_ref - The target of the branch; either a String representing an OID or a reference name, or a Rugged::Object instance.

Returns a Rugged::Branch object


225
226
227
228
229
230
231
232
233
234
# File 'lib/rugged/repository.rb', line 225

def create_branch(name, sha_or_ref = "HEAD")
  case sha_or_ref
  when Rugged::Object
    target = sha_or_ref.oid
  else
    target = rev_parse_oid(sha_or_ref)
  end

  branches.create(name, target)
end