Skip to content

Commit b0a29dd

Browse files
thiagowfxclaude
andcommitted
fix(wt): force-remove locked worktrees with -f
Pass --force twice to git worktree remove so locked worktrees (e.g., those held by claude agents) are removed without requiring manual unlock. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6851488 commit b0a29dd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wt/wt.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ COMMANDS:
4747
-h, --help Show this help message and exit
4848
--no-cd Stay in current directory after creating worktree (use with 'add' command)
4949
--current-branch, -c Start new worktree from current branch instead of default (use with 'add' command)
50-
--force, -f Force remove worktree (use with 'remove' command)
50+
--force, -f Force remove worktree, including dirty/locked ones (use with 'remove' command)
5151
5252
PREREQUISITES:
5353
- Git 2.5+ with worktree support
@@ -532,7 +532,7 @@ cmd_remove() {
532532
branch=$(git -C "$path" symbolic-ref --short HEAD 2>/dev/null || echo "")
533533

534534
if [[ "$force" == true ]]; then
535-
git worktree remove --force "$path"
535+
git worktree remove --force --force "$path"
536536
else
537537
git worktree remove "$path"
538538
fi
@@ -588,7 +588,7 @@ cmd_remove() {
588588
branch=$(git -C "$path" symbolic-ref --short HEAD 2>/dev/null || echo "")
589589

590590
if [[ "$force" == true ]]; then
591-
git worktree remove --force "$path"
591+
git worktree remove --force --force "$path"
592592
else
593593
git worktree remove "$path"
594594
fi

0 commit comments

Comments
 (0)