git

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDirtyWorktree = errors.New("worktree contains modified or untracked files")

ErrDirtyWorktree indicates the worktree contains modified or untracked files.

Functions

func BranchExists

func BranchExists(branch string) (local bool, remote bool)

BranchExists checks if a branch exists locally or remotely.

func CreateWorktree

func CreateWorktree(branch, path, baseBranch string) error

CreateWorktree creates a new worktree. If the branch exists, it uses it. Otherwise, it creates a new branch from baseBranch.

func GetRepoRoot

func GetRepoRoot() (string, error)

GetRepoRoot returns the root directory of the git repository.

func GetWorktreeDir

func GetWorktreeDir(configDir string) (string, error)

GetWorktreeDir returns the directory where worktrees should be created.

func RemoveWorktree

func RemoveWorktree(path string, force bool) error

RemoveWorktree removes a worktree.

func SanitizeBranchName

func SanitizeBranchName(branch string) string

SanitizeBranchName sanitizes a branch name for use as a directory name.

Types

type Worktree

type Worktree struct {
	Path   string
	Branch string
	Commit string
	IsMain bool
}

func ListWorktrees

func ListWorktrees() ([]Worktree, error)

ListWorktrees returns all worktrees in the repository.

Jump to

Keyboard shortcuts

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