WorktreeAddOpts
このコンテンツはまだ日本語訳がありません。
WorktreeAddOpts =
object
Defined in: src/core/repo.ts:2138
Options for adding a worktree
Properties
branch?
optionalbranch:string
Defined in: src/core/repo.ts:2156
Branch name to create (-b flag)
checkout?
optionalcheckout:boolean
Defined in: src/core/repo.ts:2166
Checkout the worktree (true) or not (false)
commitish?
optionalcommitish:string
Defined in: src/core/repo.ts:2154
Commit-ish to checkout (branch, tag, or commit hash)
Example
// Checkout a specific commit in detached modeawait repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'abc1234' });
// Checkout a tagawait repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'v1.0.0' });
// Checkout a branchawait repo.worktree.add('/tmp/worktree', { commitish: 'feature-branch' });detach?
optionaldetach:boolean
Defined in: src/core/repo.ts:2158
Create detached HEAD
force?
optionalforce:boolean
Defined in: src/core/repo.ts:2164
Force creation even if branch is already checked out
lock?
optionallock:boolean
Defined in: src/core/repo.ts:2168
Keep the worktree locked after creation
orphan?
optionalorphan:boolean
Defined in: src/core/repo.ts:2170
Create worktree with orphan branch
track?
optionaltrack:boolean
Defined in: src/core/repo.ts:2160
Track remote branch