v1

latestSwagger 2.02026-07-175445133.1 KB
git

List all worktrees

Returns a list of all worktrees for the current repository with fast cache-enhanced responses. Supports conditional requests via If-None-Match header for efficient polling.

get/v1/git/worktrees

Headers

If-None-Matchstring

ETag from previous request

Response

OK

branchstring

Current git branch name in this worktree

claude_activity_state'inactive' | 'running' | 'active'
commit_countinteger

Number of commits ahead of the divergence point (CommitHash)

commit_hashstring

Commit hash where this worktree diverged from source branch (updated after merges)

commits_behindinteger

Number of commits the source branch is ahead of our divergence point

created_atstring

When this worktree was created

has_active_claude_sessionboolean

Whether there's an active Claude session for this worktree (deprecated - use ClaudeActivityState)

has_been_renamedboolean

Whether this worktree's branch has been renamed from its original catnip ref

has_commits_ahead_of_remoteboolean

Whether the branch has commits ahead of the remote branch (calculated on list)

has_conflictsboolean

Whether the worktree is in a conflicted state (rebase/merge conflicts)

idstring

Unique identifier for this worktree

is_dirtyboolean

Whether there are uncommitted changes in the worktree

last_accessedstring

When this worktree was last accessed

latest_claude_messagestring

Latest Claude message from the current session

latest_claude_message_typestring

Type of the latest Claude message ("assistant" or "user")

latest_session_titlestring

Latest session title from the current session (simplified string version)

latest_user_promptstring

Latest user prompt from ~/.claude.json history

namestring

User-friendly name for this worktree (e.g., 'vectorize-quasar')

pathstring

Absolute path to the worktree directory

pull_request_bodystring

Body/description of the associated pull request (persisted for updates)

pull_request_last_syncedstring

Last time the PR state was synced

pull_request_statestring

State of the associated pull request (open, closed, merged)

pull_request_titlestring

Title of the associated pull request (persisted for updates)

pull_request_urlstring

URL of the associated pull request (if one exists)

repo_idstring

Repository this worktree belongs to

source_branchstring

Branch this worktree was originally created from

Example response

[
  {
    "branch": "feature/api-docs",
    "commit_count": 3,
    "commit_hash": "abc123def456",
    "commits_behind": 2,
    "created_at": "2024-01-15T14:00:00Z",
    "has_been_renamed": true,
    "id": "abc123-def456-ghi789",
    "is_dirty": true,
    "last_accessed": "2024-01-15T16:30:00Z",
    "name": "feature-api-docs",
    "path": "/workspace/worktrees/feature-api-docs",
    "pull_request_body": "This PR adds new functionality to the system",
    "pull_request_state": "open",
    "pull_request_title": "Feature: Add new functionality",
    "pull_request_url": "https://github.com/owner/repo/pull/123",
    "repo_id": "anthropics/claude-code",
    "source_branch": "main",
    "todos": [
      {
        "content": "Fix authentication bug",
        "id": "1",
        "priority": "high",
        "status": "in_progress"
      }
    ]
  }
]