Documentation
¶
Index ¶
- func BranchExists(dir, branch string) bool
- func CommitsSince(dir, ref string) (int, error)
- func CurrentBranch(dir string) (string, error)
- func DefaultBranch(dir string) (string, error)
- func DeleteBranch(repoDir, branch string) error
- func Diff(dir, spec string) (string, error)
- func DiffStat(dir, spec string) (string, error)
- func DirDiskUsage(path string) int64
- func Fetch(dir string) error
- func FetchWithRetry(dir string, maxAttempts int, onRetry func(attempt, max int, err error)) error
- func FormatBytes(b int64) string
- func IsNetworkError(err error) bool
- func IsRepo(dir string) bool
- func ParseGitHubRemote(url string) (owner, repo string)
- func RemoteURL(dir string) string
- func RepoName(dir string) (string, error)
- func TopLevel(dir string) (string, error)
- func WorktreeAdd(repoDir, worktreePath, branch string, startPoint ...string) error
- func WorktreeAddExisting(repoDir, worktreePath, branch string) error
- func WorktreePrune(repoDir string) error
- func WorktreeRemove(repoDir, worktreePath string) error
- func WorktreeRemoveByBranch(repoDir, branch string) error
- type BranchInfo
- type LogEntry
- type WorktreeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchExists ¶
BranchExists checks if a branch exists locally or as a remote tracking branch.
func CommitsSince ¶
CommitsSince returns the number of commits since a given ref.
func CurrentBranch ¶
CurrentBranch returns the current branch name.
func DefaultBranch ¶
DefaultBranch returns the default branch name (main, master, etc.).
func DeleteBranch ¶
DeleteBranch deletes a local branch.
func DirDiskUsage ¶
DirDiskUsage returns the total disk usage of a directory in bytes. Returns 0 if the directory does not exist or cannot be measured.
func FetchWithRetry ¶
FetchWithRetry fetches from origin with retries on transient network errors. Calls onRetry before each retry attempt (can be nil).
func FormatBytes ¶
FormatBytes formats a byte count as a human-readable string (KB, MB, GB).
func IsNetworkError ¶
IsNetworkError returns true if the error looks like a transient network/SSH issue.
func ParseGitHubRemote ¶
ParseGitHubRemote extracts owner/repo from a GitHub remote URL. Handles HTTPS (https://github.com/owner/repo.git) and SSH (git@github.com:owner/repo.git).
func WorktreeAdd ¶
WorktreeAdd creates a new git worktree at the given path on a new branch. If startPoint is non-empty, the branch is created from that ref instead of HEAD.
func WorktreeAddExisting ¶
WorktreeAddExisting creates a new git worktree at the given path from an existing branch. Unlike WorktreeAdd, this does not create a new branch (-b).
func WorktreePrune ¶
WorktreePrune runs git worktree prune to clean up stale bookkeeping entries.
func WorktreeRemove ¶
WorktreeRemove removes a git worktree.
func WorktreeRemoveByBranch ¶
WorktreeRemoveByBranch finds and removes any worktree that has the given branch checked out.
Types ¶
type BranchInfo ¶
BranchInfo represents a git branch.
func Branches ¶
func Branches(dir string) ([]BranchInfo, error)
Branches returns all branches (local and remote).
type LogEntry ¶
LogEntry represents a single git log entry.
type WorktreeEntry ¶
WorktreeEntry represents a git worktree.
func Worktrees ¶
func Worktrees(dir string) ([]WorktreeEntry, error)
Worktrees returns all git worktrees for the repo.