worktree

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(path, branch, startPoint string) error

Create creates a new worktree. path: The absolute path where the worktree should be created. branch: The exact name of the branch to create. startPoint: The ref to start from (e.g., HEAD, FETCH_HEAD, an existing branch).

func Exists

func Exists(path string) bool

Exists checks if a worktree already exists on disk.

func FindByName added in v0.0.2

func FindByName(name string) ([]git.WorktreeInfo, error)

FindByName finds worktrees matching the given name using suffix matching. Returns all matches, similar to how git worktree remove works.

func Remove

func Remove(path string, force bool) error

Remove removes a worktree. This function is responsible for running `git worktree remove` and ensuring the directory is gone.

Types

type WorktreeInfo

type WorktreeInfo struct {
	Type         WorktreeType
	Owner        string
	Repo         string
	Number       int
	BranchName   string
	WorktreeName string
}

WorktreeInfo contains metadata used during creation and action templating.

type WorktreeType

type WorktreeType string

WorktreeType represents the type of worktree being created.

const (
	Issue WorktreeType = "issue"
	PR    WorktreeType = "pr"
	Local WorktreeType = "local"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL