Documentation
¶
Index ¶
- type BranchInfo
- type LocalRepo
- func (r *LocalRepo) CompareBranches(base, head string) (ahead, behind int, err error)
- func (r *LocalRepo) DeleteBranch(branch string, force bool) error
- func (r *LocalRepo) GetCurrentBranch() (string, error)
- func (r *LocalRepo) GetDefaultBranch() (string, error)
- func (r *LocalRepo) GetMergeBase(branch1, branch2 string) (string, error)
- func (r *LocalRepo) IsInsideWorkTree() bool
- func (r *LocalRepo) ListBranches() ([]BranchInfo, error)
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 ¶
NewLocalRepo creates a new local repository handle.
func (*LocalRepo) CompareBranches ¶
CompareBranches compares two branches and returns ahead/behind counts.
func (*LocalRepo) DeleteBranch ¶
DeleteBranch deletes a branch locally.
func (*LocalRepo) GetCurrentBranch ¶
GetCurrentBranch returns the current branch name.
func (*LocalRepo) GetDefaultBranch ¶
GetDefaultBranch attempts to get the default branch (main or master).
func (*LocalRepo) GetMergeBase ¶
GetMergeBase returns the merge base of two branches.
func (*LocalRepo) IsInsideWorkTree ¶
IsInsideWorkTree checks if the path is inside a Git repository.
func (*LocalRepo) ListBranches ¶
func (r *LocalRepo) ListBranches() ([]BranchInfo, error)
ListBranches lists all local branches.
Click to show internal directories.
Click to hide internal directories.