コンテンツにスキップ

WorktreeAddOpts

このコンテンツはまだ日本語訳がありません。

WorktreeAddOpts = object

Defined in: src/core/repo.ts:2170

Options for adding a worktree

Properties

branch?

optional branch: string

Defined in: src/core/repo.ts:2188

Branch name to create (-b flag)


checkout?

optional checkout: boolean

Defined in: src/core/repo.ts:2198

Checkout the worktree (true) or not (false)


commitish?

optional commitish: string

Defined in: src/core/repo.ts:2186

Commit-ish to checkout (branch, tag, or commit hash)

Example

// Checkout a specific commit in detached mode
await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'abc1234' });
// Checkout a tag
await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'v1.0.0' });
// Checkout a branch
await repo.worktree.add('/tmp/worktree', { commitish: 'feature-branch' });

detach?

optional detach: boolean

Defined in: src/core/repo.ts:2190

Create detached HEAD


force?

optional force: boolean

Defined in: src/core/repo.ts:2196

Force creation even if branch is already checked out


lock?

optional lock: boolean

Defined in: src/core/repo.ts:2200

Keep the worktree locked after creation


orphan?

optional orphan: boolean

Defined in: src/core/repo.ts:2202

Create worktree with orphan branch


track?

optional track: boolean

Defined in: src/core/repo.ts:2192

Track remote branch