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
Fetches all entries after this cursor.
Fetches all entries before this cursor.
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
Format output as json.
knock branch delete <branch_name> [flags]
#Deletes the branch with the given slug.
Flags
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
Force switch the branch without confirmation.
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
Removes the confirmation prompt. Defaults to false.
Delete the branch after merging. Defaults to true.