git

package
v0.0.0-...-f6a7110 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWorktreeList

func BuildWorktreeList(worktrees []*Worktree, withIndexes bool, replaceHome string) (list string)

BuildWorktreeList formats a tabulated worktree list, with emojis and optional indexes

func Clone

func Clone(url string, args ...string) error

Clone clones a repository

func Command

func Command(args ...string) error

Command executes the specified git command. Stdout and Stderr are redirected to os.Stdout and os.Stderr.

func CommandOutput

func CommandOutput(args ...string) (out strings.Builder, err error)

CommandOutput executes the specified git command and returns its output. Stderr is redirected to os.Stderr.

func GetConfig

func GetConfig(key string, args ...string) (out strings.Builder, err error)

GetConfig gets the git config key/value pair

func NewWorktree

func NewWorktree(branch string) error

NewWorktree adds a new worktree.

func Refs

func Refs(refs string) (heads string, err error)

Refs returns specified refs, using `git for-each-ref --format='%(refname:short)'`.

func SetBare

func SetBare(bare bool) error

SetBare changes the core.bare config value.

func SetConfig

func SetConfig(key string, value string, args ...string) (err error)

SetConfig sets the git config key/value pair

Types

type Worktree

type Worktree struct {
	Path         string
	Branch       string
	Head         string
	Bare         bool
	Detached     bool
	Locked       bool
	LockedReason string
}

Worktree represents a Git worktree with its attributes.

func GitWorktreeList

func GitWorktreeList() ([]*Worktree, error)

GitWorktreeList runs `git worktree list --porcelain -z` and parses the output.

func ParseWorktrees

func ParseWorktrees(input string) ([]*Worktree, error)

ParseWorktrees parses the output of `git worktree list --porcelain -z` into Worktree structs.

Jump to

Keyboard shortcuts

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