standards/CLAUDE.md: git worktree cannot remove the worktree you're standing in
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 7
Description
Problem
While cleaning up a merged feature worktree, removal could not be done from within the worktree itself. Two compounding reasons:
- git refuses to
git worktree removethe worktree that is the current working directory. - Windows locks any directory that is a live process's CWD, so even a forced
Remove-Itemfails with "being used by another process."
Since start-work creates worktrees under .claude/worktrees/ by default, an agent (or developer) operating inside a merged worktree cannot self-remove it — the cleanup step silently stalls or errors unless you know to run it from elsewhere.
Goal
Add a short rule to the git-hygiene / worktree area of standards/CLAUDE.md so this is handled correctly the first time.
Proposed content (for standards/CLAUDE.md)
Removing a worktree
You cannot remove the worktree you are currently standing in —
git worktree removerefuses,
and on Windows the OS locks the live CWD so the directory can't be deleted either. Run cleanup
from the main repository (or another worktree):# From the MAIN repo checkout, not the worktree being removed: git worktree remove .claude/worktrees/<name> # add --force if it has untracked files git branch -d branches/<id>-<slug> # -d only deletes if merged; -D to force git push origin --delete branches/<id>-<slug> # if the remote branch is no longer neededA branch checked out in a worktree can't be deleted until that worktree is removed first.
Acceptance criteria
-
standards/CLAUDE.mddocuments that worktree removal must run from outside the target worktree. - Notes the git refusal and the Windows CWD-lock.
- Includes the correct removal order (remove worktree → delete local branch → delete remote branch).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open standards/CLAUDE.md and find the git-hygiene or worktree guidance. Add a short rule explaining that cleanup must run from the main repository or another worktree because Git refuses removal from the current worktree and Windows locks the live CWD. Document the order: remove the worktree, delete the local branch, then delete the remote branch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100