Documentation
¶
Index ¶
- type Git
- func (g *Git) AbortMerge() error
- func (g *Git) AbortRebase() error
- func (g *Git) AmendNoEdit() error
- func (g *Git) BehindCount(remote, branch string) (int, error)
- func (g *Git) Checkout(branch string) error
- func (g *Git) CheckoutReset(branch string) error
- func (g *Git) Commit(message string) error
- func (g *Git) ConfigureIdentity(name, email string) error
- func (g *Git) CreateBranch(name, from string) error
- func (g *Git) CurrentBranch() (string, error)
- func (g *Git) DefaultBranch() (string, error)
- func (g *Git) DeleteLocalBranch(name string) error
- func (g *Git) Diff(base, head string) (string, error)
- func (g *Git) DiffStat(base, head string) (string, error)
- func (g *Git) Fetch(remote string) error
- func (g *Git) ForcePush(remote, branch string) error
- func (g *Git) HasConflicts() bool
- func (g *Git) HeadSHA() (string, error)
- func (g *Git) IsDirty() (bool, error)
- func (g *Git) IsMerging() bool
- func (g *Git) Merge(branch string) error
- func (g *Git) MergeBase(a, b string) (string, error)
- func (g *Git) Pull(remote, branch string) error
- func (g *Git) Push(remote, branch string) error
- func (g *Git) Rebase(onto string) error
- func (g *Git) ResetHead() error
- func (g *Git) RevParse(ref string) (string, error)
- func (g *Git) Rm(path string) error
- func (g *Git) RmDir(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
WorkDir string
}
Git wraps the git CLI for repository operations.
func (*Git) AbortRebase ¶
AbortRebase aborts an in-progress rebase.
func (*Git) AmendNoEdit ¶ added in v0.2.7
AmendNoEdit amends the most recent commit without changing its message.
func (*Git) BehindCount ¶ added in v0.2.3
BehindCount returns the number of commits HEAD is behind remote/branch. Caller must fetch before calling this.
func (*Git) CheckoutReset ¶ added in v0.2.11
CheckoutReset checks out a branch, resetting it to match the remote tracking branch. This ensures the local branch is up-to-date even if the remote has advanced.
func (*Git) ConfigureIdentity ¶
ConfigureIdentity sets the local git user identity for commits/merges if not already set.
func (*Git) CreateBranch ¶
func (*Git) CurrentBranch ¶
func (*Git) DefaultBranch ¶ added in v0.2.3
DefaultBranch returns the default branch name by inspecting origin/HEAD. Falls back to "main" if origin/HEAD is not set.
func (*Git) DeleteLocalBranch ¶ added in v0.2.13
DeleteLocalBranch force-deletes a local branch.
func (*Git) DiffStat ¶ added in v0.2.0
DiffStat returns the --stat output for changes introduced by head since its merge base with base (three-dot diff), matching the semantics of Diff.
func (*Git) HasConflicts ¶
func (*Git) IsDirty ¶ added in v0.2.3
IsDirty returns true if the working tree has uncommitted changes (staged or unstaged, including untracked files).
func (*Git) MergeBase ¶ added in v0.2.16
MergeBase returns the merge base commit SHA between two refs.
func (*Git) ResetHead ¶ added in v0.2.7
ResetHead resets the index to match HEAD, undoing any staged changes.