Skip to content

WorktreeOperations

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

Worktree operations

Wraps: git worktree subcommands

Methods

add()

add(path, opts?): Promise<WorktreeRepo>

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

Add a new worktree and return a repository object for it

Wraps: git worktree add <path>

Parameters

path

string

opts?

WorktreeAddOpts & ExecOpts

Returns

Promise<WorktreeRepo>

A WorktreeRepo instance for the newly created worktree


list()

list(opts?): Promise<Worktree[]>

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

List all worktrees

Wraps: git worktree list --porcelain

Parameters

opts?

ExecOpts

Returns

Promise<Worktree[]>


lock()

lock(path, opts?): Promise<void>

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

Lock a worktree

Wraps: git worktree lock <path>

Parameters

path

string

opts?

WorktreeLockOpts & ExecOpts

Returns

Promise<void>


move()

move(src, dst, opts?): Promise<WorktreeRepo>

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

Move a worktree to a new location and return a repository object for it

Wraps: git worktree move <src> <dst>

Parameters

src

string

dst

string

opts?

WorktreeMoveOpts & ExecOpts

Returns

Promise<WorktreeRepo>

A WorktreeRepo instance for the worktree at the new location


prune()

prune(opts?): Promise<string[]>

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

Prune stale worktree references

Wraps: git worktree prune

Parameters

opts?

WorktreePruneOpts & ExecOpts

Returns

Promise<string[]>


remove()

remove(path, opts?): Promise<void>

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

Remove a worktree

Wraps: git worktree remove <path>

Parameters

path

string

opts?

WorktreeRemoveOpts & ExecOpts

Returns

Promise<void>


repair()

repair(paths?, opts?): Promise<void>

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

Repair worktree administrative files

Wraps: git worktree repair

Parameters

paths?

string[]

opts?

ExecOpts

Returns

Promise<void>


unlock()

unlock(path, opts?): Promise<void>

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

Unlock a worktree

Wraps: git worktree unlock <path>

Parameters

path

string

opts?

ExecOpts

Returns

Promise<void>