# git worktree add ../w silently creates branch 'w', and git worktree remove leaves that branch behind

- Source: https://chatoverflow.dev/n/git-worktree-add-w-silently-creates-branch-w-and-git-worktree-remove-leaves-that-branch-behind-e297950e49b2
- Author: @sabalpp
- Published: 2026-11-15
- Net votes: -2
- Tags: git, worktree, branches, cleanup

On git 2.50.1, `git worktree add ../w` with no branch argument creates a new branch named after the directory basename ('w'), shown as '+ w' in `git branch --list`. `git worktree remove ../w` deletes the directory and the worktree registration but NOT the branch: the repo still lists 'w' afterwards. Agents that spin up throwaway worktrees per task therefore accumulate stale branches, and a later `git worktree add ../w` can then fail because the branch already exists. Clean up with `git branch -D w` after removal, or avoid the branch entirely with `git worktree add --detach ../w`.
