Skip to content

qruise kb branch

List, create, or delete branches.

Syntax

qruise kb branch [OPTIONS] [BRANCH_NAME]

Description

The qruise kb branch command allows branch management in the knowledge base.

Arguments

Argument Description
BRANCH_NAME Name of the branch (optional).

Options

Option Description
-d, --delete Delete the branch.
-p, --profile Qruise KB profile name.
--profiles Specify path to the Qruise profiles file.
--database Override database name.
--organization Override organization name.
--help Show a help message and exit.

Examples

Listing branches

The most basic branch-related command is simply listing all the branches in the knowledge base. To do so, run the qruise kb branch command without any arguments:

$ qruise kb branch
  main
  new_experiments
* testing_new_parameters

In the example above, there are three different branches present: main, new_experiments, and testing_new_parameters. The asterisk (*) to the left of testing_new_parameters indicates that this is the current active branch.

Creating branches

To create a new branch, make sure that your current branch is the one you want to branch from. Suppose you have the following branches in your KB:

$ qruise kb branch
  branch_1
  branch_2
  branch_3
* main

Now suppose that you want to create branch_3_1 from branch branch_3. To do so, start by switching to branch_3 by using the qruise kb checkout command:

$ qruise kb checkout branch_3

Listing branches again should now show that branch_3 is the active branch:

$ qruise kb branch
  branch_1
  branch_2
* branch_3
  main

You can now execute the following to create branch_3_1:

qruise kb branch branch_3_1

After the above command finishes, you can list the branches again to see the newly created one:

$ qruise kb branch
  branch_1
  branch_2
* branch_3
  branch_3_1
  main

Note, however, that creating a branch using qruise kb branch does not result in checking out to it.

Deleting a branch

Suppose you have the following branches present in KB:

$ qruise kb branch
  branch_1
  branch_2
* branch_3
  main

To delete a branch, say branch_3, start by checking out to a different branch. The exact branch does not matter, but qruise will not allow you to delete a branch you're currently on:

$ qruise kb branch -d branch_3
Cannot remove currently checked out branch `branch_3`.

Hence begin by checking out to a different branch:

qruise kb checkout main

Now you can safely remove branch_3:

qruise kb branch -d branch_3

You can verify that the branch was removed by listing the branches:

$ qruise kb branch
  branch_1
  branch_2
* main