Skip to content

git worktree-clone

Clone a repository into a worktree-based directory structure

TIP

This command is also available as daft clone. See daft clone.

Description

Clones a repository into a directory structure optimized for worktree-based development. The resulting layout is:

<repository-name>/.git    (bare repository metadata)
<repository-name>/<branch>  (worktree for the checked-out branch)

The command first queries the remote to determine the default branch (main, master, or other configured default), then performs a bare clone and creates the initial worktree. This structure allows multiple worktrees to be created as siblings, each containing a different branch.

If the repository contains a .daft/hooks/ directory and the repository is trusted, lifecycle hooks are executed. See git-daft(1) for hook management.

Usage

git worktree-clone [OPTIONS] <REPOSITORY_URL>

Arguments

ArgumentDescriptionRequired
<REPOSITORY_URL>The repository URL to clone (HTTPS or SSH)Yes

Options

OptionDescriptionDefault
-b, --branch <BRANCH>Branch to check out (repeatable; use HEAD or @ for default branch)
-n, --no-checkoutPerform a bare clone only; do not create any worktree
-q, --quietOperate quietly; suppress progress reporting
-v, --verboseIncrease verbosity (-v for hook details, -vv for full sequential output)
-a, --all-branchesCreate a worktree for each remote branch, not just the default
--trust-hooksTrust the repository and allow hooks to run without prompting
--no-hooksDo not run any hooks from the repository
-r, --remote <REMOTE>Organize worktree under this remote folder (enables multi-remote mode)
--no-cdDo not change directory to the new worktree
--layout <LAYOUT>Worktree layout to use for this repository
--columns <COLUMNS>Columns to display (comma-separated). Replace: branch,base,age. Modify defaults: +col,-col. Available: branch, path, size, base, changes, remote, age, annotation, owner, hash, last-commit
-x, --exec <EXEC>Run a command in the worktree after setup completes (repeatable)

Global Options

OptionDescription
-h, --helpPrint help information
-V, --versionPrint version information

See Also

Released under the MIT License.