git

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 BranchDelete

func BranchDelete(branch string, force bool) error

BranchDelete deletes a branch.

func BranchExists

func BranchExists(branch string) bool

BranchExists checks if a branch exists in the repository.

func Command

func Command(args ...string) error

Command runs a git command in the current directory.

func CommandOutput

func CommandOutput(args ...string) (string, error)

CommandOutput runs a git command and returns the output from current directory.

func CommandOutputAt

func CommandOutputAt(path string, args ...string) (string, error)

CommandOutputAt runs a git command and returns the output from specified directory.

func CommandSilent

func CommandSilent(args ...string) error

CommandSilent runs a git command without output in the current directory.

func Fetch

func Fetch(refs ...string) error

Fetch fetches refs from origin.

func GetCurrentBranch

func GetCurrentBranch(path string) (string, error)

GetCurrentBranch returns the current branch name in the specified directory.

func GetCurrentBranchAtCwd

func GetCurrentBranchAtCwd() (string, error)

GetCurrentBranchAtCwd returns the current branch name at current working directory.

func GetGitRoot added in v0.0.4

func GetGitRoot() (string, error)

GetGitRoot returns the git root directory.

func GetRepoName added in v0.0.2

func GetRepoName() (string, error)

GetRepoName returns the repository name from the current working directory.

func GetWorktreeBranch

func GetWorktreeBranch(worktreePath string) (string, error)

GetWorktreeBranch returns the branch that a worktree is on.

func HasUncommittedChanges

func HasUncommittedChanges(worktreePath string) bool

HasUncommittedChanges checks if a worktree has uncommitted changes.

func IsGitRepository

func IsGitRepository(path string) bool

IsGitRepository checks if a directory is a git repository.

func WorktreeAdd

func WorktreeAdd(branch, worktreePath string) error

WorktreeAdd adds a worktree with a new branch.

func WorktreeAddFromBranch

func WorktreeAddFromBranch(branch, worktreePath string) error

WorktreeAddFromBranch adds a worktree from an existing branch.

func WorktreeAddFromRef

func WorktreeAddFromRef(branch, worktreePath, ref string) error

WorktreeAddFromRef adds a worktree from a specific ref.

func WorktreeIsRegistered

func WorktreeIsRegistered(worktreePath string) bool

WorktreeIsRegistered checks if a worktree path is registered in git.

func WorktreePrune

func WorktreePrune() error

WorktreePrune prunes stale worktree records.

func WorktreeRemove

func WorktreeRemove(worktreePath string, force bool) error

WorktreeRemove removes a worktree.

Types

type WorktreeInfo

type WorktreeInfo struct {
	Path   string
	Branch string
}

WorktreeInfo represents information about a worktree.

func GetWorktreeInfo

func GetWorktreeInfo() ([]WorktreeInfo, error)

GetWorktreeInfo returns worktree info (path and branch) for all worktrees.

Jump to

Keyboard shortcuts

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