The [branch] Command

branch

List, create, or delete branches

Usage

libra branch [OPTIONS] [NEW_BRANCH] [COMMIT_HASH]

Arguments

  • [NEW_BRANCH] - New branch name
  • [COMMIT_HASH] - Base branch name or commit hash

Description

If --list is given, or if there are no non-option arguments, existing local branches are listed; the current branch will be highlighted in green and marked with an asterisk, same as git.

If a new branch name is given, a new branch is created that points to the given commit hash. If no commit hash is given, the new branch will point to the current commit.

Options

  • -l, --list
    List all branches, don't include remote branches. The order is not guaranteed, mostly it is sorted by the created order.
  • -D, --delete <DELETE>
    Force delete branch
  • -u, --set-upstream-to <SET_UPSTREAM_TO>
    Set up <branchname>'s tracking information so <upstream> is considered <branchname>'s upstream branch.
  • --show-current
    Show current branch
  • -r, --remotes
    Show remote branches
  • -h, --help
    Print help

Note:

All parameters should align with Git’s behavior as closely as possible, but there may be some differences. Refs https://git-scm.com/docs/git-branch for more information.