Skip to content

git worktree-branch-delete

Delete branches and their worktrees

WARNING

This command is deprecated. Use git worktree-branch -d/-D instead. See git worktree-branch.

Description

Deletes one or more local branches along with their associated worktrees and remote tracking branches in a single operation. This is the inverse of git-worktree-checkout(1) -b.

Arguments can be branch names or worktree paths. When a path is given (absolute, relative, or "."), the branch checked out in that worktree is resolved automatically. This is convenient when you are inside a worktree and want to delete it without remembering the branch name.

Safety checks prevent accidental data loss. The command refuses to delete a branch that:

  • has uncommitted changes in its worktree
  • has not been merged (or squash-merged) into the default branch
  • is out of sync with its remote tracking branch

Use -D (--force) to override these safety checks. For the default branch (e.g. main), --force removes its worktree only — the local branch ref and remote branch are always preserved.

All targeted branches are validated before any deletions begin. If any branch fails validation without --force, the entire command aborts and no branches are deleted.

Pre-remove and post-remove lifecycle hooks are executed for each worktree removal if the repository is trusted. See git-daft(1) for hook management.

Usage

git worktree-branch-delete [OPTIONS] <BRANCHES>

Arguments

ArgumentDescriptionRequired
<BRANCHES>Branches to delete (names or worktree paths)Yes

Options

OptionDescriptionDefault
-D, --forceForce deletion even if not fully merged
-q, --quietOperate quietly; suppress progress reporting
-v, --verboseBe verbose; show detailed progress

Global Options

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

See Also

Released under the MIT License.