git

List all worktrees

Returns a list of all worktrees for the current repository with fast cache-enhanced responses

get/v1/git/worktrees

Response

OK

branchstring

Current git branch name in this worktree

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

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

namestring

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

pathstring

Absolute path to the worktree directory

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",
    "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_url": "https://github.com/owner/repo/pull/123",
    "repo_id": "anthropics/claude-code",
    "source_branch": "main"
  }
]

Changes