Skip to content

Command syntax

text
cleft [-C <path>] add [<options>] <path> [<commit-ish>]
cleft [-C <path>] include [--json] <worktree-path>
cleft [-C <path>] doctor [--json]
cleft [-C <path>] <list|lock|unlock|move|remove|repair|prune> [<args>]

Choose a repository

-C <path> or -C<path> changes the starting directory. Put it before the subcommand. Repeat it to resolve each subsequent relative directory from the preceding one. With git cleft, you can also use Git's git -C <path> cleft add <worktree-path> syntax.

Create a worktree

sh
cleft add -b feature/parser ../wt-parser HEAD
cleft add -qd ../wt-test HEAD~1
cleft add --require-cow --verify=hash --detach ../wt-verified HEAD

Use -b <branch> for a new branch, -B <branch> to create or reset one, and -d or --detach for a detached checkout. Combine compatible short options, for example -qd or -qb <branch>. Use -- to end options. Other Git options are supported directly or delegated to Git as needed.

Control cloning and verification

Option Effect
--require-cow
Fail instead of falling back to plain git worktree add when CoW cannot be used. This does not require every file to originate from a reflink.
--verify=stat
Default. Use index stat metadata and a timestamp guard to verify donor files.
--verify=hash
Read and hash donor file contents for verification.
--include / --no-include
Override whether include manifests apply.
--index-version=2\|3\|4
Override the index version on the native path.
--json
Report the result as JSON. Check the exit status and, when provided, the backend and fallback_reason fields.

Manage worktrees

  • cleft include <worktree-path> applies an include manifest from the current source worktree to an existing one. Add --json for a machine-readable result.
  • cleft doctor --json reports local filesystem capabilities and relevant repository settings. Omit --json for readable text.
  • cleft list, lock, unlock, move, remove, repair and prune run the corresponding git worktree command with the supplied arguments.

Configuration

  • git config cleft.autoInclude false disables automatic manifest application for this repository. Use --global to set a user-wide default. --include and --no-include take precedence for one invocation.
  • git config index.version 2 selects an older index format if another tool needs it. Cleft uses v4 unless configured otherwise or overridden with --index-version.
  • Cleft reads relevant Git settings, including the repository object format, sparse checkout and worktree configuration. Depending on the settings, it may ask Git to register the worktree or check out affected paths.