Versions in this module Expand all Collapse all v0 v0.0.4 Mar 23, 2026 v0.0.3 Mar 23, 2026 v0.0.2 Mar 23, 2026 Changes in this version type Client + func (c *Client) DiffFileNames(ctx context.Context, commitA, commitB string) ([]string, error) type StatusReader + DiffFileNames func(ctx context.Context, commitA, commitB string) ([]string, error) v0.0.1 Mar 19, 2026 Changes in this version + const FieldSep + const RecordEnd + const ShortHashLen + func CheckGitInstalled() error + func JoinPaths(paths []string) string + func RemoteToHTTPS(raw string) string + func ValidateArg(arg string) error + func ValidatePath(path string) error + func ValidateRef(ref string) error + func ValidateRepoRelativePath(path string) error + func WorktreePath(repoRoot, branch string) string + type BisectOps interface + BisectBad func(ctx context.Context) (string, error) + BisectGood func(ctx context.Context) (string, error) + BisectReset func(ctx context.Context) error + BisectStart func(ctx context.Context, bad, good string) error + type BlameLine struct + Author string + Content string + Date time.Time + Hash string + LineNo int + type Branch struct + Ahead int + Behind int + Hash string + IsCurrent bool + IsRemote bool + Name string + Upstream string + type BranchManager interface + BranchCreate func(ctx context.Context, name string, base string) error + BranchDelete func(ctx context.Context, name string, force bool) error + BranchList func(ctx context.Context) ([]Branch, error) + BranchRename func(ctx context.Context, oldName, newName string) error + Checkout func(ctx context.Context, ref string) error + type Cache struct + func NewCache(maxAge time.Duration) *Cache + func (c *Cache) GetBranches() ([]Branch, bool) + func (c *Cache) GetStatus() ([]FileStatus, bool) + func (c *Cache) Invalidate() + func (c *Cache) SetBranches(branches []Branch) + func (c *Cache) SetStatus(status []FileStatus) + type Client struct + func NewClient(repoDir string) (*Client, error) + func NewClientWithCache(repoDir string, cache *Cache) (*Client, error) + func (c *Client) BisectBad(ctx context.Context) (string, error) + func (c *Client) BisectGood(ctx context.Context) (string, error) + func (c *Client) BisectReset(ctx context.Context) error + func (c *Client) BisectStart(ctx context.Context, bad, good string) error + func (c *Client) Blame(ctx context.Context, path string) ([]BlameLine, error) + func (c *Client) BranchCreate(ctx context.Context, name, base string) error + func (c *Client) BranchDelete(ctx context.Context, name string, force bool) error + func (c *Client) BranchList(ctx context.Context) ([]Branch, error) + func (c *Client) BranchRename(ctx context.Context, oldName, newName string) error + func (c *Client) Checkout(ctx context.Context, ref string) error + func (c *Client) CherryPick(ctx context.Context, commitHash string) error + func (c *Client) Commit(ctx context.Context, msg string, opts CommitOpts) (string, error) + func (c *Client) Diff(ctx context.Context, opts DiffOpts) ([]FileDiff, error) + func (c *Client) DiffTreeFiles(ctx context.Context, hash string) ([]string, error) + func (c *Client) DiscardAllUnstaged(ctx context.Context) error + func (c *Client) DiscardFile(ctx context.Context, path string) error + func (c *Client) Fetch(ctx context.Context, opts FetchOpts) error + func (c *Client) IgnoredPaths(ctx context.Context) ([]string, error) + func (c *Client) InvalidateCache() + func (c *Client) IsRepo(ctx context.Context) (bool, error) + func (c *Client) Log(ctx context.Context, opts LogOpts) ([]Commit, error) + func (c *Client) Merge(ctx context.Context, branch string, opts MergeOpts) error + func (c *Client) MergeAbort(ctx context.Context) error + func (c *Client) Pull(ctx context.Context, opts PullOpts) error + func (c *Client) Push(ctx context.Context, opts PushOpts) error + func (c *Client) Rebase(ctx context.Context, onto string, opts RebaseOpts) error + func (c *Client) RebaseAbort(ctx context.Context) error + func (c *Client) RebaseContinue(ctx context.Context) error + func (c *Client) Reflog(ctx context.Context, ref string, limit int) ([]ReflogEntry, error) + func (c *Client) RemoteAdd(ctx context.Context, name, url string) error + func (c *Client) RemoteList(ctx context.Context) ([]Remote, error) + func (c *Client) RemoteRemove(ctx context.Context, name string) error + func (c *Client) RepoDir() string + func (c *Client) RepoRoot(ctx context.Context) (string, error) + func (c *Client) Reset(ctx context.Context, ref string, mode ResetMode) error + func (c *Client) Revert(ctx context.Context, hash string) error + func (c *Client) RevertAbort(ctx context.Context) error + func (c *Client) RevertContinue(ctx context.Context) error + func (c *Client) Stage(ctx context.Context, paths []string) error + func (c *Client) StageHunk(ctx context.Context, path string, hunk Hunk) error + func (c *Client) StageLine(ctx context.Context, path string, hunk Hunk, lineIdx int) error + func (c *Client) StashApply(ctx context.Context, index int) error + func (c *Client) StashDrop(ctx context.Context, index int) error + func (c *Client) StashList(ctx context.Context) ([]StashEntry, error) + func (c *Client) StashPop(ctx context.Context, index int) error + func (c *Client) StashPush(ctx context.Context, opts StashOpts) error + func (c *Client) StashShow(ctx context.Context, index int) (string, error) + func (c *Client) Status(ctx context.Context) ([]FileStatus, error) + func (c *Client) TagCreate(ctx context.Context, name, ref, message string) error + func (c *Client) TagDelete(ctx context.Context, name string) error + func (c *Client) TagList(ctx context.Context) ([]Tag, error) + func (c *Client) TagListRemote(ctx context.Context, remote string) ([]Tag, error) + func (c *Client) TagPush(ctx context.Context, remote, name string) error + func (c *Client) TagPushAll(ctx context.Context, remote string) error + func (c *Client) Unstage(ctx context.Context, paths []string) error + func (c *Client) UnstageHunk(ctx context.Context, path string, hunk Hunk) error + func (c *Client) UnstageLine(ctx context.Context, path string, hunk Hunk, lineIdx int) error + func (c *Client) WorktreeAdd(ctx context.Context, path, branch string) error + func (c *Client) WorktreeList(ctx context.Context) ([]Worktree, error) + func (c *Client) WorktreeRemove(ctx context.Context, path string, force bool) error + type Commit struct + Author string + AuthorEmail string + Body string + Date time.Time + Hash string + Parents []string + Refs []string + ShortHash string + Subject string + type CommitOpts struct + AllowEmpty bool + Amend bool + Author string + Fixup string + RewordOnly bool + Sign bool + type DiffLine struct + Content string + NewLine int + OldLine int + Type DiffLineType + type DiffLineType int + const DiffLineAdded + const DiffLineContext + const DiffLineRemoved + type DiffOpts struct + CommitA string + CommitB string + Context int + IgnoreAll bool + NameOnly bool + Path string + Staged bool + StatOnly bool + type DiscardOps interface + DiscardAllUnstaged func(ctx context.Context) error + DiscardFile func(ctx context.Context, path string) error + type FetchOpts struct + All bool + Prune bool + Remote string + Tags bool + type FileDiff struct + Hunks []Hunk + IsBinary bool + OldPath string + Path string + type FileStatus struct + OrigPath string + Path string + StagedStatus StatusCode + WorktreeStatus StatusCode + type GitClient interface + type Hunk struct + Header string + Lines []DiffLine + NewLines int + NewStart int + NoNewlineEOF bool + OldLines int + OldStart int + type IgnoreChecker interface + IgnoredPaths func(ctx context.Context) ([]string, error) + type IndexMutator interface + Commit func(ctx context.Context, msg string, opts CommitOpts) (string, error) + Stage func(ctx context.Context, paths []string) error + StageHunk func(ctx context.Context, path string, hunk Hunk) error + StageLine func(ctx context.Context, path string, hunk Hunk, lineIdx int) error + Unstage func(ctx context.Context, paths []string) error + UnstageHunk func(ctx context.Context, path string, hunk Hunk) error + UnstageLine func(ctx context.Context, path string, hunk Hunk, lineIdx int) error + type LogOpts struct + All bool + Author string + Graph bool + Grep string + MaxCount int + Path string + Ref string + Since string + Skip int + Until string + type MergeOpts struct + FFOnly bool + Message string + NoFF bool + Squash bool + type MergeRebaseOps interface + CherryPick func(ctx context.Context, commitHash string) error + Merge func(ctx context.Context, branch string, opts MergeOpts) error + MergeAbort func(ctx context.Context) error + Rebase func(ctx context.Context, onto string, opts RebaseOpts) error + RebaseAbort func(ctx context.Context) error + RebaseContinue func(ctx context.Context) error + type OpQueue struct + func (q *OpQueue) Exec(ctx context.Context, fn func() error) error + type PullOpts struct + Branch string + NoRebase bool + Rebase bool + Remote string + type PushOpts struct + Branch string + Force bool + ForceWith bool + Remote string + SetUpstream bool + Tags bool + type RebaseOpts struct + Interactive bool + type ReflogEntry struct + Action string + Date time.Time + Hash string + Message string + type ReflogOps interface + Reflog func(ctx context.Context, ref string, limit int) ([]ReflogEntry, error) + type Remote struct + FetchURL string + Name string + PushURL string + type RemoteListOps interface + RemoteAdd func(ctx context.Context, name, url string) error + RemoteList func(ctx context.Context) ([]Remote, error) + RemoteRemove func(ctx context.Context, name string) error + type RemoteOps interface + Fetch func(ctx context.Context, opts FetchOpts) error + Pull func(ctx context.Context, opts PullOpts) error + Push func(ctx context.Context, opts PushOpts) error + type ResetMode string + const ResetHard + const ResetMixed + const ResetSoft + type ResetOps interface + Reset func(ctx context.Context, ref string, mode ResetMode) error + type RevertOps interface + Revert func(ctx context.Context, hash string) error + RevertAbort func(ctx context.Context) error + RevertContinue func(ctx context.Context) error + type StashEntry struct + Branch string + Date time.Time + Hash string + Index int + Message string + type StashOps interface + StashApply func(ctx context.Context, index int) error + StashDrop func(ctx context.Context, index int) error + StashList func(ctx context.Context) ([]StashEntry, error) + StashPop func(ctx context.Context, index int) error + StashPush func(ctx context.Context, opts StashOpts) error + StashShow func(ctx context.Context, index int) (string, error) + type StashOpts struct + KeepIndex bool + Message string + Paths []string + Staged bool + type StatusBranch struct + Ahead int + Behind int + Head string + OID string + Upstream string + func ParseStatusBranch(output string) StatusBranch + type StatusCode byte + const StatusAdded + const StatusConflict + const StatusCopied + const StatusDeleted + const StatusIgnored + const StatusModified + const StatusRenamed + const StatusUnmodified + const StatusUntracked + func (s StatusCode) String() string + type StatusReader interface + Blame func(ctx context.Context, path string) ([]BlameLine, error) + Diff func(ctx context.Context, opts DiffOpts) ([]FileDiff, error) + DiffTreeFiles func(ctx context.Context, hash string) ([]string, error) + IsRepo func(ctx context.Context) (bool, error) + Log func(ctx context.Context, opts LogOpts) ([]Commit, error) + RepoRoot func(ctx context.Context) (string, error) + Status func(ctx context.Context) ([]FileStatus, error) + type Tag struct + Date time.Time + Hash string + IsAnnotated bool + Message string + Name string + Tagger string + type TagOps interface + TagCreate func(ctx context.Context, name, ref, message string) error + TagDelete func(ctx context.Context, name string) error + TagList func(ctx context.Context) ([]Tag, error) + TagListRemote func(ctx context.Context, remote string) ([]Tag, error) + TagPush func(ctx context.Context, remote, name string) error + TagPushAll func(ctx context.Context, remote string) error + type UndoAction struct + Metadata map[string]string + RefBefore string + Type string + type UndoManager struct + func NewUndoManager(client *Client) *UndoManager + func (u *UndoManager) CanRedo() bool + func (u *UndoManager) CanUndo() bool + func (u *UndoManager) NeedsConfirmation() bool + func (u *UndoManager) PeekRedo() (UndoAction, bool) + func (u *UndoManager) PeekUndo() (UndoAction, bool) + func (u *UndoManager) RecordAction(action UndoAction) + func (u *UndoManager) Redo(ctx context.Context) (string, error) + func (u *UndoManager) RedoNeedsConfirmation() bool + func (u *UndoManager) Undo(ctx context.Context) (string, error) + type Worktree struct + Bare bool + Branch string + Head string + Path string + type WorktreeOps interface + WorktreeAdd func(ctx context.Context, path, branch string) error + WorktreeList func(ctx context.Context) ([]Worktree, error) + WorktreeRemove func(ctx context.Context, path string, force bool) error