worktree

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CherryPickConflictError

type CherryPickConflictError struct {
	Commit       string
	SourceBranch string
	Output       string
}

CherryPickConflictError represents a conflict during cherry-pick

func (*CherryPickConflictError) Error

func (e *CherryPickConflictError) Error() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles git worktree operations

func New

func New(repoDir string) (*Manager, error)

New creates a new worktree Manager

func (*Manager) AbortCherryPick

func (m *Manager) AbortCherryPick(path string) error

AbortCherryPick aborts an in-progress cherry-pick

func (*Manager) CheckCherryPickConflicts

func (m *Manager) CheckCherryPickConflicts(path, sourceBranch string) ([]string, error)

CheckCherryPickConflicts checks if cherry-picking a branch would cause conflicts Returns a list of files that would conflict, or empty if clean

func (*Manager) CherryPickBranch

func (m *Manager) CherryPickBranch(path, sourceBranch string) error

CherryPickBranch cherry-picks all commits from sourceBranch that aren't in the current branch It cherry-picks commits one by one in order (oldest first)

func (*Manager) CommitAll

func (m *Manager) CommitAll(path, message string) error

CommitAll commits all changes in a worktree

func (*Manager) ContinueCherryPick

func (m *Manager) ContinueCherryPick(path string) error

ContinueCherryPick continues cherry-pick after conflict resolution

func (*Manager) CountCommitsBetween

func (m *Manager) CountCommitsBetween(path, baseBranch, headBranch string) (int, error)

CountCommitsBetween returns the number of commits between base and head branches. This is more efficient than GetCommitsBetween when you only need the count.

func (*Manager) Create

func (m *Manager) Create(path, branch string) error

Create creates a new worktree at the given path with a new branch

func (*Manager) CreateBranchFrom

func (m *Manager) CreateBranchFrom(branchName, baseBranch string) error

CreateBranchFrom creates a new branch from a specified base branch (without creating a worktree)

func (*Manager) CreateFromBranch

func (m *Manager) CreateFromBranch(path, newBranch, baseBranch string) error

CreateFromBranch creates a new worktree at the given path with a new branch based off a specific base branch. This is used when we want a task's branch to start from a consolidated branch rather than HEAD.

func (*Manager) CreateWorktreeFromBranch

func (m *Manager) CreateWorktreeFromBranch(path, branch string) error

CreateWorktreeFromBranch creates a worktree from an existing branch

func (*Manager) DeleteBranch

func (m *Manager) DeleteBranch(branch string) error

DeleteBranch deletes a branch

func (*Manager) FindMainBranch

func (m *Manager) FindMainBranch() string

FindMainBranch is the exported version of findMainBranch

func (*Manager) GetBehindCount

func (m *Manager) GetBehindCount(path string) (int, error)

GetBehindCount returns how many commits the branch is behind origin/main

func (*Manager) GetBranch

func (m *Manager) GetBranch(path string) (string, error)

GetBranch returns the branch for a worktree

func (*Manager) GetChangedFiles

func (m *Manager) GetChangedFiles(path string) ([]string, error)

GetChangedFiles returns a list of files changed compared to main

func (*Manager) GetCommitLog

func (m *Manager) GetCommitLog(path string) (string, error)

GetCommitLog returns the commit log for the current branch since it diverged from main

func (*Manager) GetCommitsBetween

func (m *Manager) GetCommitsBetween(path, baseBranch, headBranch string) ([]string, error)

GetCommitsBetween returns the commit SHAs between base and head (exclusive of base)

func (*Manager) GetConflictingFiles

func (m *Manager) GetConflictingFiles(path string) ([]string, error)

GetConflictingFiles returns files with merge conflicts in a worktree

func (*Manager) GetDiffAgainstMain

func (m *Manager) GetDiffAgainstMain(path string) (string, error)

GetDiffAgainstMain returns the diff of the branch against main/master

func (*Manager) HasCommitsBeyond

func (m *Manager) HasCommitsBeyond(path, baseBranch string) (bool, error)

HasCommitsBeyond returns true if the branch has commits beyond the base branch

func (*Manager) HasRebaseConflicts

func (m *Manager) HasRebaseConflicts(path string) (bool, error)

HasRebaseConflicts checks if rebasing on main would cause conflicts Returns true if conflicts would occur, false if rebase would be clean

func (*Manager) HasUncommittedChanges

func (m *Manager) HasUncommittedChanges(path string) (bool, error)

HasUncommittedChanges checks if a worktree has uncommitted changes

func (*Manager) IsCherryPickInProgress

func (m *Manager) IsCherryPickInProgress(path string) bool

IsCherryPickInProgress returns true if a cherry-pick is in progress

func (*Manager) List

func (m *Manager) List() ([]string, error)

List returns all worktrees

func (*Manager) Push

func (m *Manager) Push(path string, force bool) error

Push pushes the current branch to the remote

func (*Manager) RebaseOnMain

func (m *Manager) RebaseOnMain(path string) error

RebaseOnMain rebases the current branch on main/master

func (*Manager) Remove

func (m *Manager) Remove(path string) error

Remove removes a worktree

Jump to

Keyboard shortcuts

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