Skip to content

getBranch

Lookup a branch by its name in a repository.

Signature

ts
class Repository {
  getBranch(name: string, branchType: BranchType): Branch;
}

Parameters

  • namerequired · string

    A branch name.

  • branchTyperequired · BranchType

    Branch type to lookup.

    - Local : A local branch not on a remote.
    - Remote : A branch for a remote.

Returns

  • Branch

    A found branch.

Errors

  • Error

    Throws error if branch does not exist.

Released under the MIT License.