Documentation
¶
Overview ¶
Package gitutil provides small read-only helpers over the git CLI for repository metadata (root, current/default branch, cleanliness).
Index ¶
- func CurrentBranch(ctx context.Context, dir string) (string, error)
- func DefaultBranch(ctx context.Context, dir string) (string, error)
- func Exec(ctx context.Context, dir string, args ...string) (string, error)
- func HasRemote(ctx context.Context, dir, remote string) bool
- func IsClean(ctx context.Context, dir string) (bool, error)
- func RemoteURL(ctx context.Context, dir, remote string) (string, error)
- func RepoRoot(ctx context.Context, dir string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentBranch ¶
CurrentBranch returns the checked-out branch name (or "HEAD" when detached).
func DefaultBranch ¶
DefaultBranch resolves the repository's default branch, preferring origin/HEAD, then a local main/master, then the current branch.
func Exec ¶
Exec runs an arbitrary git command in dir, returning combined output. Use for mutating operations (add/commit/push) where the caller wants the message.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.