Documentation
¶
Index ¶
- func IsGitRepository(path string) bool
- type BranchTracking
- type Repository
- func (r *Repository) Fetch() error
- func (r *Repository) GetBranchesTrackingStatus() ([]BranchTracking, error)
- func (r *Repository) GetCurrentBranch() (string, error)
- func (r *Repository) GetStatus() (*Status, error)
- func (r *Repository) Pull(branch string) error
- func (r *Repository) SetUpstream() error
- type Status
- type StatusType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGitRepository ¶
IsGitRepository checks if a path is a git repository
Types ¶
type BranchTracking ¶ added in v1.2.5
BranchTracking represents the tracking status of a branch
type Repository ¶
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" )