Skip to content
CommandImported

worktree-init

Create parallel worktrees for multi-task development with Ghostty panels

Imported description, not reviewed yet

This item came from its original repository and was only scanned automatically; no editor has written an Arabic description for it yet. Read its content yourself before you rely on it. This page is not indexed by search engines until it is reviewed.

Download

Files: 1 · Size: 4.1 KB

Download the ZIP

The file carries the license of the original source.

Install

After downloading, run the command in a terminal. unzip asks before it replaces any file that is there.

  • For this project

    It goes in: .claude/commands/

    mkdir -p .claude/commands && unzip ~/Downloads/worktree-init.zip -d .claude/commands

  • For your account on the whole machine

    It goes in: ~/.claude/commands/

    mkdir -p ~/.claude/commands && unzip ~/Downloads/worktree-init.zip -d ~/.claude/commands

Instructions

Worktree Parallel Init

Create multiple git worktrees for parallel development: $ARGUMENTS

Instructions

You are setting up parallel worktrees so the user can work on multiple tasks simultaneously in separate Ghostty terminal panels, each running its own Claude instance.

Step 1: Validate Environment

  1. Check this is a git repository: git rev-parse --is-inside-work-tree
  2. Get the repo name: basename $(git rev-parse --show-toplevel)
  3. Get the main branch name (check for main or master): git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' — if that fails, default to main
  4. Ensure working tree is clean: git status --porcelain. If dirty, warn the user and ask if they want to continue.
  5. Fetch latest: git fetch origin

Step 2: Parse Tasks

Parse tasks from $ARGUMENTS. Tasks are separated by | (pipe character).

If $ARGUMENTS is empty, use AskUserQuestion to ask the user to describe their tasks (they can provide multiple separated by |).

For each task description:

  • Trim whitespace
  • Generate a kebab-case branch name: claude/<kebab-case-task> (max 50 chars, alphanumeric and hyphens only)
  • Generate a worktree directory path: ../worktrees/<repo-name>/claude-<kebab-case-task>

Step 3: Create Worktrees

For each task:

  1. Create the parent directory if needed: mkdir -p ../worktrees/<repo-name>
  2. Create the worktree:
    git worktree add -b claude/<name> ../worktrees/<repo-name>/claude-<name> origin/<main-branch>
    
  3. Write a .worktree-task.md file inside the new worktree with this content:
    # Worktree Task
    
    **Branch:** claude/<name>
    **Task:** <original task description>
    **Created:** <ISO date>
    **Source repo:** <path to main repo>
    

Step 4: Check for Dependencies

If a package.json exists in the repo root, note that each worktree may need npm install (or the appropriate package manager).

Check for:

  • package-lock.json → npm install
  • yarn.lock → yarn install
  • pnpm-lock.yaml → pnpm install
  • bun.lockb → bun install

Step 5: Output Summary

Display a clear summary table:

| # | Task | Branch | Path |
|---|------|--------|------|
| 1 | ... | claude/... | ../worktrees/repo/claude-... |

Then display ready-to-copy commands for Ghostty panels. For each worktree:

# Panel <N>: <task description>
cd <absolute-path-to-worktree> && claude

If dependencies were detected, add a note:

# Note: Run <package-manager> install in each worktree before starting

Finally, remind the user:

  • Open a new Ghostty panel with Cmd+D (split right) or Cmd+Shift+D (split down)
  • When done with a task, use /worktree-deliver to commit, push, and create a PR
  • After merging all PRs, use /worktree-cleanup --all from the main repo

Files

  • LICENSE1 KB
  • worktree-init.md3 KB

Comments (0)

No comments yet. Be the first.

Sign in to comment. Commenting comes at level 1 (Member).

Report

Similar items

  • CommandImported

    architecture-review

    Comprehensive architecture review with design patterns analysis and improvement recommendations

    MITFiles: 1

  • CommandImported

    architecture-scenario-explorer

    Explore architectural decisions through systematic scenario analysis with trade-off evaluation and future-proofing assessment.

    MITFiles: 1

  • CommandImported

    block-no-verify

    Set up PreToolUse hook to block --no-verify and other git bypass flags in Claude Code projects

    MITFiles: 1

  • CommandImported

    c4-architecture

    Generate comprehensive C4 architecture documentation (Context, Container, Component, Code) for a codebase using bottom-up analysis and four coordinated C4 agents.

    MITFiles: 1

  • CommandImported

    clean_gone

    Cleans up all git branches marked as [gone] (branches that have been deleted on the remote but still exist locally), including removing associated worktrees.

    Apache-2.0Files: 1

  • CommandImported

    clean-branches

    Clean up merged and stale git branches

    MITFiles: 1