Worktree Finish
Brings changes from a feature worktree back into main, then removes the worktree and branch.
What it does
- Validates the worktree exists and has no uncommitted changes
- Runs checks in the worktree (auto-detects test/check scripts)
- Merges
work/<feature-name>directly intomain - Removes the worktree directory and deletes the branch
- Cleans up
.worktrees/dir if empty
Usage
/worktree-finish <feature-name>
How to execute
This must be run from the ORIGINAL project directory (not the worktree).
bash .claude/skills/worktree-finish/scripts/worktree-finish.sh "<feature-name>"
Where <feature-name> matches the name used with /worktree-start.
Important
- The worktree must have all changes committed (no dirty working tree)
- Tests/checks are run in the worktree before merging — if they fail, the merge is aborted
- Merges directly into
main(no intermediate review branch) - If there are merge conflicts, the script stops and provides manual resolution steps
- Use
git reset --hard ORIG_HEADto undo the merge if needed - The merge preserves full commit history from the worktree branch
- Unlike
merge-back, no temporary remotes are needed — branch is already local