git

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCommit

func CreateCommit(dir string, message string, files ...string) error

CreateCommit stages the given files and creates a commit.

func CreateTag

func CreateTag(dir string, tag string, message string) error

CreateTag creates an annotated git tag.

func LatestSemverTag

func LatestSemverTag(dir string, prefix ...string) (version.Semver, error)

LatestSemverTag returns the highest semver tag, or 0.0.0 if none exist. An optional prefix filters tags (e.g., "cli" matches "cli/v1.0.0").

func ListSemverTags

func ListSemverTags(dir string, prefix ...string) ([]version.Semver, error)

ListSemverTags returns all tags that parse as valid semver, sorted descending. An optional prefix filters tags (e.g., "cli" matches "cli/v1.0.0").

func NamespacedTagString added in v0.3.0

func NamespacedTagString(prefix string, v version.Semver) string

NamespacedTagString returns a tag string with the given prefix. e.g., NamespacedTagString("cli", v) returns "cli/v1.2.0". If prefix is empty, returns the standard "v1.2.0" format.

func Push

func Push(dir string, tags ...string) error

Push pushes the current branch and any specified tags to the remote in a single command to avoid partial-failure states.

func RemoteOwnerRepo added in v0.0.2

func RemoteOwnerRepo(dir string) (owner, repo string, err error)

RemoteOwnerRepo parses the origin remote URL to extract the repository owner and name. It supports both HTTPS and SSH URL formats.

Types

type CommitLog

type CommitLog struct {
	Hash    string
	Subject string
	Body    string
}

CommitLog represents a single git commit.

func LogBetween

func LogBetween(dir string, fromRef, toRef string, pathFilter ...string) ([]CommitLog, error)

LogBetween returns commits between fromRef and toRef (exclusive fromRef). If fromRef is empty, returns all commits up to toRef. An optional pathFilter restricts results to commits touching files under that path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL