Skip to content

daft remove

Delete branches and their worktrees

Usage

daft remove [OPTIONS] <BRANCHES>
daft remove -f <BRANCHES>

This is equivalent to git worktree-branch -d (safe delete). Use -f to force-delete branches regardless of merge status (git worktree-branch -D).

Description

Deletes one or more local branches along with their associated worktrees in a single operation. Arguments can be branch names or worktree paths.

When invoked outside any git repository, daft remove accepts absolute or relative worktree paths and discovers the owning repository from the path itself, so worktrees can be cleaned up without first cd-ing into a sibling worktree. All paths in a single invocation must belong to the same repository.

By default, the remote branch is not deleted. To also delete the remote branch, set daft.branchDelete.remote true or use daft config remote-sync --on. You can also pass --remote to delete only the remote branch while keeping the local worktree and branch, or --local to skip the remote entirely regardless of config.

Safety checks prevent accidental data loss. Use -f (--force) to override. For the default branch (e.g. main), -f removes its worktree only -- the local branch ref and remote branch are always preserved.

Options

OptionDescriptionDefault
-f, --forceForce deletion even if not fully merged
--localDelete only locally; do not touch the remote branch
--remoteDelete only the remote branch; keep the local worktree and branch
-v, --verboseShow detailed progress
-q, --quietSuppress non-error output

Global Options

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

See Also

Released under MIT or Apache-2.0.