From finalize-worktree
Commit all worktree changes, sync from main branch, run tests, and merge back. Use when done working in a git worktree.
How this skill is triggered — by the user, by Claude, or both
Slash command
/finalize-worktree:finalize-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Commit, verify, and merge the current worktree branch back into the main branch.
Commit, verify, and merge the current worktree branch back into the main branch.
Before anything, confirm you are inside a git worktree:
git rev-parse --is-inside-work-tree # must be true
git worktree list # must show 2+ entries
Parse git worktree list output:
MAIN_REPO.WT_BRANCH.If the current directory IS the main working tree (not a worktree), stop and tell the user — this skill is only for worktrees.
Detect the main branch (the branch to merge into):
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null — most reliable if remote exists.main, master, develop, trunk exists locally.Run in parallel:
git status (never use -uall flag)git diff --statgit log --oneline -5git add -A or git add .).git log --oneline -5 for the project's commit message style and follow it. If no clear convention, use conventional commits (feat:, fix:, refactor:, etc.).Pull in any new commits from the main branch:
git merge <MAIN_BRANCH> --no-edit
If conflicts arise, resolve them carefully before continuing.
Run the project's test suite. Check CLAUDE.md first for a project-specific test command. Otherwise look for common test config files (package.json, Makefile, Cargo.toml, pyproject.toml, build.gradle, pom.xml, etc.) and run the appropriate test command. If no test setup exists, skip.
If the project has a CLAUDE.md, check whether it mentions any post-work steps (e.g. writing lessons, updating docs, updating changelogs). Follow those instructions if applicable.
Operate on the main working tree using git -C <MAIN_REPO>:
# 1. Check if main working tree is clean
git -C <MAIN_REPO> status --short
# 2. Stash if dirty (skip if clean)
git -C <MAIN_REPO> stash --include-untracked
# 3. Merge the worktree branch
git -C <MAIN_REPO> merge <WT_BRANCH> --no-edit
# 4. Pop stash if we stashed (skip if nothing was stashed)
git -C <MAIN_REPO> stash pop
If stash pop conflicts, warn the user and leave the stash intact for manual resolution.
Summarize:
--no-verify to skip hooks.git merge, not git pull.npx claudepluginhub whiskychoy/whisky-claude-plugins --plugin finalize-worktreeCreates isolated git worktrees for branch work, auto-installs dependencies, verifies baselines, and handles branch finishing with clean isolation.
Automates git workflow: creates isolated worktrees for features with .gitignore safety checks, enables atomic commits, completes branches via merge, PR, preserve, or discard.
Guides completing development branches by verifying tests, detecting workspace state, and offering structured options for merge, PR, or cleanup.