Documentation
¶
Overview ¶
Package git provides functions for interacting with git repositories by shelling out to the git CLI.
Index ¶
- func CommitDate(repoPath, branch string) (time.Time, error)
- func CurrentBranch(repoPath string) (string, error)
- func DefaultBranch(repoPath string) (string, error)
- func DeleteLocalBranch(repoPath, branch string, force bool) error
- func DeleteRemoteBranch(repoPath, remote, branch string) error
- func Fetch(repoPath, remote string) error
- func HasRemote(repoPath, remote string) bool
- func IsClean(repoPath string) (bool, error)
- func IsMerged(repoPath, branch, base string) (bool, error)
- func IsRepo(path string) bool
- func ListBranches(repoPath string) ([]string, error)
- func MergeAbort(repoPath string) error
- func MergeBase(repoPath string, ref1, ref2 string) (string, error)
- func MergeTree(repoPath string, base, local, remote string) (string, bool, error)
- func MergedBranches(repoPath, base string) ([]string, error)
- func Pull(repoPath string, strategy string) error
- func RebaseAbort(repoPath string) error
- func RemoteURL(repoPath, remote string) (string, error)
- func StashPop(repoPath string) error
- func StashPush(repoPath string, message string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitDate ¶
CommitDate returns the author date of the latest commit on the given branch.
func CurrentBranch ¶
CurrentBranch returns the name of the currently checked-out branch.
func DefaultBranch ¶
DefaultBranch returns the default branch name (main or master) by checking what the origin HEAD points to, falling back to a local heuristic.
func DeleteLocalBranch ¶
DeleteLocalBranch deletes a local branch. If force is true, uses -D instead of -d.
func DeleteRemoteBranch ¶
DeleteRemoteBranch deletes a branch on the given remote.
func ListBranches ¶
ListBranches returns all local branch names.
func MergeAbort ¶ added in v0.2.0
MergeAbort aborts an in-progress merge, restoring the branch to its pre-merge state.
func MergeBase ¶ added in v0.2.0
MergeBase returns the best common ancestor commit between two refs.
func MergeTree ¶ added in v0.2.0
MergeTree performs a three-way merge-tree between base, local, and remote tree-ish references. It returns the merge output, whether conflicts were detected, and any error. This is a read-only operation that does not modify the working tree.
func MergedBranches ¶
MergedBranches returns local branches that have been merged into the given base branch.
func Pull ¶ added in v0.2.0
Pull pulls from the default remote using the given strategy. Valid strategies: "rebase", "merge", "ff-only".
func RebaseAbort ¶ added in v0.2.0
RebaseAbort aborts an in-progress rebase, restoring the branch to its pre-rebase state.
Types ¶
This section is empty.