コンテンツにスキップ

WorktreeAddOpts

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

WorktreeAddOpts = object

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

Options for adding a worktree

Properties

branch?

optional branch: string

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

Branch name to create (-b flag)


checkout?

optional checkout: boolean

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

Checkout the worktree (true) or not (false)


commitish?

optional commitish: string

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

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:2158

Create detached HEAD


force?

optional force: boolean

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

Force creation even if branch is already checked out


lock?

optional lock: boolean

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

Keep the worktree locked after creation


orphan?

optional orphan: boolean

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

Create worktree with orphan branch


track?

optional track: boolean

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

Track remote branch