wt remove
Remove a git worktree cleanly, checking for uncommitted changes first.
Synopsis
Description
wt remove removes a git worktree cleanly. It checks for uncommitted changes before proceeding and optionally deletes the associated git branch.
Arguments
| Argument | Description |
|---|---|
<branch> | Branch name or partial match. "feat" matches "shreyansh/feat-billing" |
Options
| Option | Description |
|---|---|
--force | Remove even if there are uncommitted changes; also force-deletes the branch (-D instead of -d) |
--keep-branch | Remove the worktree but keep the git branch |
Behaviour
- Find the worktree by branch name (exact or partial match)
- Check for uncommitted changes — abort unless
--force - Run
git worktree remove - Delete the git branch with
git branch -d(unless--keep-branch)
Examples
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error |
2 | Partial success (worktree removed but branch deletion failed) |