Skip to content

rename ​

Move/rename an existing local branch reference.

Signature ​

ts
class Branch {
  rename(newBranchName: string, options?: BranchRenameOptions | null | undefined): Branch;
}

Parameters ​

  • newBranchNamerequired · string

    Branch name to move/rename.

  • optionsnull | BranchRenameOptions

    Options for move/rename branch.

    • forceboolean

      If the force flag is not enabled, and there's already a branch with the given name, the renaming will fail.

Returns ​

  • Branch

    Move/renamed branch.

Released under the MIT License.