Worktree Check
Check current worktree status, branch, and assigned task
$ npx claude-code-templates@latest --command="git-workflow/worktree-check" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Worktree Status Check
Verify the current worktree environment and show task details.
Instructions
You are inside a worktree (or the main repo). Gather and display the current status clearly.
Step 1: Detect Worktree
- Get the current directory:
pwd - List all worktrees:
git worktree list - Determine if the current directory is a worktree (not the main working tree). The main working tree is listed first in
git worktree listoutput — if the current path matches the first entry, this is the main repo, not a worktree.
If this is not a worktree, inform the user:
You're in the main repository, not a worktree. Use /worktree-init to create worktrees.
Then list any existing worktrees and exit.
Step 2: Show Branch Info
- Get current branch:
git branch --show-current - Verify it follows the
claude/,claude-daniel/, orreview/*naming convention - Show how many commits ahead of origin/main:
git rev-list --count origin/main..HEAD
Step 3: Read Task
- Check if
.worktree-task.mdexists in the worktree root - If it exists, read and display its contents
- If it doesn't exist, note that no task file was found (may have been created manually)
Step 4: Show Working Status
Run and display:
git status --short— show modified, staged, and untracked filesgit diff --stat— show a summary of unstaged changes
Step 5: Display Summary
Present a clean summary:
Worktree Status
──────────────────────────────────
Branch: claude/<name>
Task: <task description from .worktree-task.md>
Commits: <N> ahead of main
Modified: <N> files
Staged: <N> files
Untracked: <N> files
──────────────────────────────────
If there are changes ready to deliver, suggest: "Run /worktree-deliver when you're ready to commit, push, and create a PR."
Related Claude Code Commands
Commit
Create well-formatted commits with conventional commit format and emoji
Create Pr
A ready-to-install Claude Code component.
Pr Review
A ready-to-install Claude Code component.
Fix Github Issue
A ready-to-install Claude Code component.
Create Pull Request
A ready-to-install Claude Code component.
Branch Cleanup
Use PROACTIVELY to clean up merged branches, stale remotes, and organize branch structure
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.