Table of Contents (3.3.22)

# switch

Purpose:

  Set the branch of a checkout and update.

Usage:

  brz switch [TO_LOCATION]

Options:
  `-b, --create-branch`

    Create the target branch from this one before switching to it.

  `-d ARG, --directory=ARG`

    Branch to operate on, instead of working directory.

  `--force`

    Switch even if local commits will be lost.

  `-h, --help`

    Show help message.

  `-q, --quiet`

    Only display errors and warnings.

  `-r ARG, --revision=ARG`

    See “help revisionspec” for details.

  `--store`

    Store and restore uncommitted changes in the branch.

  `--usage`

    Show usage message and options.

  `-v, --verbose`

    Display more information.

Description:

  For lightweight checkouts, this changes the branch being referenced. For heavyweight checkouts, this checks that there are no local commits versus the current bound branch, then it makes the local branch a mirror of the new location and binds to it.

  In both cases, the working tree is updated and uncommitted changes are merged. The user can commit or revert these as they desire.

  Pending merges need to be committed or reverted before using switch.

  The path to the branch to switch to can be specified relative to the parent directory of the current branch. For example, if you are currently in a checkout of /path/to/branch, specifying ‘newbranch’ will find a branch at /path/to/newbranch.

  Bound branches use the nickname of its master branch unless it is set locally, in which case switching will update the local nickname to be that of the master.