Branches

Commands for managing branches in the Knock CLI.

#

Branches are a way to isolate changes to your Knock resources. It's like a sandbox for your changes, allowing you to make changes to your resources without affecting the main branch (your development environment), or other branches in your account.

knock branch list [flags]

#

Lists all branches within your Knock account. You can paginate the results using the --after and --before flags.

Flags

--afterstring

Fetches all entries after this cursor.

--beforestring

Fetches all entries before this cursor.

--limitnumber

The total number to fetch per page.

knock branch create <branch_name> [flags]

#

Creates a new branch with the given slug. If the branch already exists, the command will return an error.

Flags

--jsonstring

Format output as json.

knock branch delete <branch_name> [flags]

#

Deletes the branch with the given slug.

Flags

--forceboolean

Force delete the branch without confirmation.

knock branch switch <branch_name> [flags]

#

Switches to an existing branch with the given slug.

Switching to the branch will persist until you exit the branch with the knock branch exit command by updating the .knockbranch file in your directory.

Flags

--forceboolean

Force switch the branch without confirmation.

--createboolean

Create the branch if it doesn't exist before switching to it.

knock branch exit

#

Exits the current branch by updating the .knockbranch file in your directory to the main branch.

knock branch merge <branch_name> [flags]

#

Merges a branch into the development environment. By default, the branch will be deleted after merging.

Flags

--forceboolean

Removes the confirmation prompt. Defaults to false.

--[no-]deleteboolean

Delete the branch after merging. Defaults to true.

New chat