git

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchInfo

type BranchInfo struct {
	Name           string
	SHA            string
	Ahead          int
	Behind         int
	LastCommitDate time.Time
	LastCommitMsg  string
}

BranchInfo represents information about a branch.

type LocalRepo

type LocalRepo struct {
	Path string
}

LocalRepo represents a local Git repository.

func NewLocalRepo

func NewLocalRepo(path string) *LocalRepo

NewLocalRepo creates a new local repository handle.

func (*LocalRepo) CompareBranches

func (r *LocalRepo) CompareBranches(base, head string) (ahead, behind int, err error)

CompareBranches compares two branches and returns ahead/behind counts.

func (*LocalRepo) DeleteBranch

func (r *LocalRepo) DeleteBranch(branch string, force bool) error

DeleteBranch deletes a branch locally.

func (*LocalRepo) GetCurrentBranch

func (r *LocalRepo) GetCurrentBranch() (string, error)

GetCurrentBranch returns the current branch name.

func (*LocalRepo) GetDefaultBranch

func (r *LocalRepo) GetDefaultBranch() (string, error)

GetDefaultBranch attempts to get the default branch (main or master).

func (*LocalRepo) GetMergeBase

func (r *LocalRepo) GetMergeBase(branch1, branch2 string) (string, error)

GetMergeBase returns the merge base of two branches.

func (*LocalRepo) IsInsideWorkTree

func (r *LocalRepo) IsInsideWorkTree() bool

IsInsideWorkTree checks if the path is inside a Git repository.

func (*LocalRepo) ListBranches

func (r *LocalRepo) ListBranches() ([]BranchInfo, error)

ListBranches lists all local branches.

Jump to

Keyboard shortcuts

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