Skip to content

mochi worktree add ​

Create a new worktree and branch.

Synopsis ​

Create a new git worktree for the given branch. If the branch does not exist, it is created from HEAD (or the ref given by --base). If PATH is omitted, the worktree is placed under the workspace's worktreeDir (default .worktrees/).

Examples: flow worktree add feature/auth flow worktree add feature/auth --base develop flow worktree add bugfix/login ./tmp/login-fix flow worktree add release/v2 --no-create-branch

shell
mochi worktree add BRANCH [PATH] [flags]

Options ​

FlagTypeDescription
-b, --basestringBase branch or commit to create the new branch from. Defaults to HEAD.
--dirstringParent directory for the new worktree. Defaults to the workspace's worktreeDir or .worktrees/.
-h, --helphelp for add
--no-create-branchUse an existing branch instead of creating a new one.
-o, --outputstringOutput format. One of: yaml, json, or tui.

Options inherited from parent commands ​

FlagTypeDescription
-L, --log-levelstringLog verbosity level (debug, info, fatal) (default "info")
--syncSync the executable cache first, pulling git-sourced workspaces from their remotes

See also ​