Skip to content

garden worktree

Manage additional working copies of a repository

Terminal window
garden worktree

Aliases: wt

Create additional checkouts of one repository that share its history but keep their own working copy, so you can work on several things at once. Like git worktrees: each has its own files and current commit, and a commit made in one is reachable from the others (they share history) but does not clutter their view.

Garden has no named branches: a worktree is a path with a commit checked out. A ‘-b <name>’ is accepted as a label — you start committing and open a pull request as usual.

Create a new worktree at <path>, checked out to <commit>

Terminal window
garden worktree add [flags] <path> [<commit>]

Create a new checkout at <path> that shares this repository’s history. With no <commit> it checks out the commit you’re currently on; name any commit (including a local, un-pushed one) to start there instead.

Flag Type Default Description
-b, --branch string Label for the new line of work (garden has no branches)
-B, --branch-reset string Same as –branch (accepted for git parity)
--checkout bool true Populate the working copy (default)
--detach bool Check out the commit detached (the default; accepted for parity)
-f, --force bool Proceed even if <path> already exists (must be empty)
--guess-remote bool Accepted for git parity (no effect)
--lock bool Mark the worktree locked (guards it from remove/prune)
--no-checkout bool Leave the working copy empty
--no-track bool Accepted for git parity (no effect)
--orphan string Start an empty worktree with no checked-out commit
-q, --quiet bool Suppress informational notes
--reason string Reason recorded with –lock
--track bool Accepted for git parity (no effect)

List the repository’s worktrees

Terminal window
garden worktree list
Flag Type Default Description
--porcelain bool Machine-readable output (path, commit, label per line)

Drop registry entries whose worktree is gone

Terminal window
garden worktree prune
Flag Type Default Description
-n, --dry-run bool Show what would be pruned without changing anything
-v, --verbose bool Report each pruned worktree

Remove a worktree

Terminal window
garden worktree remove [-f] <path>
Flag Type Default Description
-f, --force bool Remove even with uncommitted changes or a lock