git

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitRepository

func IsGitRepository(path string) bool

IsGitRepository checks if a path is a git repository

Types

type BranchTracking added in v1.2.5

type BranchTracking struct {
	Branch  string
	Message string
}

BranchTracking represents the tracking status of a branch

type Repository

type Repository struct {
	Path string
	Name string
}

Repository represents a git repository

func NewRepository

func NewRepository(path, name string) *Repository

NewRepository creates a new Repository instance

func (*Repository) Fetch added in v1.2.0

func (r *Repository) Fetch() error

Fetch runs git fetch to update remote tracking branches

func (*Repository) GetBranchesTrackingStatus added in v1.2.5

func (r *Repository) GetBranchesTrackingStatus() ([]BranchTracking, error)

GetBranchesTrackingStatus checks all local branches and returns those that are behind their remote

func (*Repository) GetCurrentBranch added in v1.2.8

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

GetCurrentBranch returns the name of the current branch

func (*Repository) GetStatus

func (r *Repository) GetStatus() (*Status, error)

GetStatus retrieves the git status of a repository

func (*Repository) Pull added in v1.2.15

func (r *Repository) Pull(branch string) error

Pull runs git pull origin <branch> to update a specific branch

func (*Repository) SetUpstream

func (r *Repository) SetUpstream() error

SetUpstream configures upstream tracking locally without pushing

type Status

type Status struct {
	Type           StatusType
	Message        string
	Symbol         string
	Branch         string           // Current branch name
	BehindBranches []BranchTracking // Branches that are behind their remote
}

Status represents the git status of a repository

type StatusType

type StatusType string

StatusType represents the type of git status

const (
	StatusSync          StatusType = "sync"
	StatusUnsync        StatusType = "unsync"
	StatusError         StatusType = "error"
	StatusIgnored       StatusType = "ignored"
	StatusNoUpstream    StatusType = "no_upstream"
	StatusBrokenSymlink StatusType = "broken_symlink"
)

Jump to

Keyboard shortcuts

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